Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add code for playlist unlimit 36 videos #64

Open
jgqipzmvakfaj opened this issue Oct 27, 2021 · 0 comments
Open

add code for playlist unlimit 36 videos #64

jgqipzmvakfaj opened this issue Oct 27, 2021 · 0 comments

Comments

@jgqipzmvakfaj
Copy link

jgqipzmvakfaj commented Oct 27, 2021

playlist download will limit 36 videos, i add some code to get all page
not enough time test all playlist, but i think it works

from pyquery import PyQuery as pq # bs4 out of the practice
tokenSearch = re.compile('data-token="([a-zA-Z0-9_-]+\.)')
cookies = {
    xxxxxxxxxxxxxxxxxxxxx
}
        url = "https://www.pornhub.com/" + str(row[1]) + "/" + str(row[2] + url_after)
        if str(row[1]) not in ['model', 'users', 'channels']:
            r = requests.get(url,
                             proxies={'http_proxy': 'http://127.0.0.1:xxxx', 'https_proxy': 'http://127.0.0.1:xxxx'},
                             cookies=cookies)
            r.encoding = 'utf8'
            p = pq(r.text)('.usernameWrap.clearfix').text()
            end = int(re.findall('.*- (\d+).*videos', p)[0]) // 40 + 2 # use all videos count the end page

            # print(f'end page {end}')
            token = tokenSearch.findall(r.text)[0] #next page use

            url = "https://www.pornhub.com/{}/viewChunked?id={}&token={}&page={}" # next page format
            for _ in range(1, end):
                with youtube_dl.YoutubeDL(ydl_opts_start) as ydl:
                    ydl.download([url.format(str(row[1]), str(row[2]),token, str(_))])
        else:
            with youtube_dl.YoutubeDL(ydl_opts_start) as ydl:
                ydl.download([url])```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant