How I can automate youtube to play a most viewed video from a particular channel

Hi, I want to automate the youtube to play most viewed video from a particular channel for that I have used the data scrapping after getting the particular channel, I am getting the video tittle, views and url my intention is to compare the views and based on that get the url and navigate to that page. but the problem is the views contains k,lakhs etc at the end like “2.5k”,“100lakh” how I will convert it to double like 2.5*1000=2500 and than compare…

anyone please help

One way I suggest is to remove the k,L,M,B and multiply with relevant value in if conditions.

This will take multiple if statements, How I will manage these things.

There would be few If statements for K,L,M,B,T. But I am not sure if there is any other easy option.

Yes. That’s why I am asking. I need simpler way to do. But Thank you. :grinning:

1 Like

Hey @mukesh_behera,

Try fetching view details from the different element. Something like below which doesn’t have shorthand format.

Hope this helps.

Thanks :slight_smile:

I did not get it because I have never done like this before.

1 Like

@mukesh_behera, Hopefully you should get the data by means of scraping or get text.

Just use the element indicated instead of the actual views element to get unformatted value.

Instead of scraping the value from price element, try scraping data from title element of the video. You need to use full text activity.

Thanks :slight_smile:

1 Like

Here my requirement is that i have to collect all videos views and show the video whose views is highest. Than how i will get the test for all the videos

1 Like

Hey @mukesh_behera,

Find below some sample code which can help you.

Youtube.zip (2.6 KB)

Page I used - https://www.youtube.com/c/SonyMusicSouth/videos

Thanks :slight_smile:

1 Like

Thank you so much.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.