Closed iced-queen closed 1 year ago
Just go the issue where it'd return the homepage again. The output looks like this:
{
id: 'https://www.pornhub.com/',
title: 'Free Porn Videos & Sex Movies - Porno, XXX, Porn Tube | Pornhub',
views: 0,
vote: { up: 0, down: 0, total: 0, rating: NaN },
premium: false,
thumb: '',
videos: [],
provider: null,
tags: [],
pornstars: [],
categories: [],
duration: 0,
durationFormatted: '00:00'
}
Thanks for reporting. I will look into it.
Btw, I think there is something blocking us to get the correct content. Our CI testing sometimes will fail for unknown reasons.
preview
: I didn't notice that we can get preview
from the video page. This will be added as an enhancement. đ views
: This is a historical issue. When I created this library, Pornhub still provided detailed views on the video page. So I choose to parse the string. But why not parse the views on the search page? My bad đ¤Ŗ
I'm thinking about providing two new fields for parsed/original strings.For the issue of getting homepage from randomVideo()
, I have no idea :(
Let me know if you found any pattern. đ
For the issue of getting homepage from
randomVideo()
, I have no idea :( Let me know if you found any pattern. đ
It seems to be a bug on PH's end. I just tried the /random
endpoint multiple times and it directed me to the homepage sometimes. I guess a workaround for this would be with a while
loop? And have it repeat the process if <result>.id
is equal to https://www.pornhub.com/
.
Also I just tried:
let res = await pornhub.randomVideo()
if (res.id === 'https://www.pornhub.com/') return;
console.log(res)
let info = await pornhub.video(res.id)
console.log(info)
return
Those two returns the exact same and neither has a preview
.
{
id: 'ph61e099ebaefbe',
title: '18 yr old gets backshots ',
views: 0,
vote: { up: 0, down: 0, total: 0, rating: NaN },
premium: false,
thumb: '',
videos: [],
provider: null,
tags: [
'ebony',
'girl-loses-virginity',
'ebony-backshots',
'homemade',
'real-couple-homemade',
'amateur-college',
'anal'
],
pornstars: [],
categories: [
'60FPS',
'Amateur',
'College-(18+)',
'Ebony',
'Female-Orgasm',
'Reality',
'Small-Tits',
'Teen-(18+)',
'Verified-Amateurs'
],
duration: 12,
durationFormatted: '00:12'
}
{
id: 'ph61e099ebaefbe',
title: '18 yr old gets backshots ',
views: 0,
vote: { up: 0, down: 0, total: 0, rating: NaN },
premium: false,
thumb: '',
videos: [],
provider: null,
tags: [
'ebony',
'girl-loses-virginity',
'ebony-backshots',
'homemade',
'real-couple-homemade',
'amateur-college',
'anal'
],
pornstars: [],
categories: [
'60FPS',
'Amateur',
'College-(18+)',
'Ebony',
'Female-Orgasm',
'Reality',
'Small-Tits',
'Teen-(18+)',
'Verified-Amateurs'
],
duration: 12,
durationFormatted: '00:12'
}
views
and vote
are both incorrect. provider
is also null
.
Plus the searchVideo()
function returns the actual URL (<result>.url
) which I liked. It's kinda annoying having to do
let url = 'https://www.pornhub.com/view_video.php?viewkey=' + res.id
with some of the functions :D
searchVideo()
and video()
will respond with id
and url
. You don't need to concat the URL manually anymore.preview
is provided in video()
, but the size is actually bigger than the one you get in search.NaN
on rating from the output you pasted. Fixed đ For the issue of empty views and votes, this is the output I get from ph61e099ebaefbe. I suspect there is a regional difference in the DOM structure. Btw, you can notice that there is a small diff on title.
{
id: 'ph61e099ebaefbe',
url: 'https://www.pornhub.com/view_video.php?viewkey=ph61e099ebaefbe',
title: '18 Yr old Gets Backshots',
views: 3000,
vote: { up: 8, down: 1, total: 9, rating: 0.89 },
premium: false,
thumb: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
preview: 'https://di.phncdn.com/videos/202201/13/401270691/original/(m=eaAaGwObaaamqv)(mh=u1n8G4v4Uj8UTXSs)7.jpg',
videos: [],
categories: [
'60FPS',
'Amateur',
'College-(18+)',
'Ebony',
'Female-Orgasm',
'Reality',
'Small-Tits',
'Teen-(18+)',
'Verified-Amateurs'
],
duration: 12,
durationFormatted: '00:12'
}
And for the redirection strategy, I would say handling this in the library is not ideal. Maybe we should detect this kind of URL mismatch and throw a Custom Error?
Hi @chocobearxo , do you 100% see the empty views
and vote
? If so, please provide me the HTML of the video page.
Dude, this random video is so unstable. I got like 2/5 chances to get the main page. đ¤Ŗ
Hi @chocobearxo , do you 100% see the empty
views
andvote
? If so, please provide me the HTML of the video page.
Sorry can you update me a bit where we're at? đ
Dude, this random video is so unstable. I got like 2/5 chances to get the main page. đ¤Ŗ
Yes!
Sorry can you update me a bit where we're at? đ
This issue contains many minor items, and most of them have been fixed.\
I have moved the views formatting issue to #78
Now empty views
is the last thing we need to focus on.
But the problem is I don't know what HTML you actually get in the library.
This has been fixed, haven't it?
I don't know, did you still get 0 views
with video("ph61e099ebaefbe")
?
I don't know, did you still get 0
views
withvideo("ph61e099ebaefbe")
?
I just tried to log the result from video()
and it returned:
{
id: 'ph61b09f51588ec',
url: 'https://www.pornhub.com/view_video.php?viewkey=ph61b09f51588ec',
title: 'Big Ass Latina is Fucked by her Stepbrother after the Gym. she Rides him and Takes all the Cum',
views: 7800000,
vote: { up: 20000, down: 3000, total: 23000, rating: 0.87 },
premium: false,
thumb: 'https://ei.phncdn.com/videos/202112/08/399331681/original/(m=eaf8Ggaaaa)(mh=x3pHVpB3KOGFFwpr)8.jpg',
preview: 'https://ei.phncdn.com/videos/202112/08/399331681/original/(m=eaAaGwObaaaa)(mh=vHcc0xLJsGnbrhm3)8.jpg',
videos: [],
provider: { username: 'lunaalessandra', url: '/model/lunaalessandra' },
tags: [
'step-brother', 'big-ass',
'big-tits', 'ebony',
'cum-on-tits', 'hot-latin',
'hot-step-sister', 'real-amateur',
'sloppy-blowjob', 'sex-after-gym',
'riding-dick', 'doggystyle-pov',
'horny-stepsister', 'big-boobes-babe',
'tight-pussy', 'sexo-duro'
],
pornstars: [],
categories: [
'Big-Ass',
'Big-Tits',
'Blowjob',
'Exclusive',
'HD-Porn',
'Hardcore',
'Latina',
'POV',
'Step-Fantasy',
'Verified-Amateurs',
'Verified-Couples'
],
duration: 1568,
durationFormatted: '26:08',
uploadDate: 2021-12-08T14:08:21.000Z
}
So I'd assume it's fixed, yes. :)
By the way a reminder that you'd add formatted views (#78) đ
I know, I know đŠī¸
Hey there,
I just tried out the
randomVideo
function and it doesn't really seem to return the same data as a video from for examplesearchVideo
. For example; the result'spreview
doesn't exist, instead there'sthumb
which returns something rather useless. At least, I have no idea how to convert it to an image url.thumb: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
Another thing, the
views
aren't formatted like videos fromsearchVideo
either. Those will return e.g. "1.2M", but therandomVideo
function will return a whole number. Maybe also return a formatted version, otherwise I have no issue with using:That's just a matter of wanting my code to look clean. :)
I also had an encounter where the
randomVideo
function didn't even return a video, but instead the normal PH homepage xD