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])```
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