autoplay first video in results of youtube using python

autoplay first video in results of youtube using python



I want to make an app where I search by typing a certain keyword and the program automatically plays the first video in the search results on youtube. Is it possible? How can I make such an app? I am lost and do not know where to start.




1 Answer
1



this code is to prints the link of the first video on a search result you provide to the app.. example :-
run the app .. type hello its me .. then it does it magic.


import urllib.request
import urllib.parse
import re
import webbrowser as wb

query_string = urllib.parse.urlencode("search_query" : input())
html_cont = urllib.request.urlopen("http://www.youtube.com/results?"+query_string)
search_res = re.findall(r'href="/watch?v=(.11)', html_content.read().decode())
print("http://www.youtube.com/watch?v=" + search_results[0])
wb.open_new("http://www.youtube.com/watch?v=".format(search_results[0]))






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

ԍԁԟԉԈԐԁԤԘԝ ԗ ԯԨ ԣ ԗԥԑԁԬԅ ԒԊԤԢԤԃԀ ԛԚԜԇԬԤԥԖԏԔԅ ԒԌԤ ԄԯԕԥԪԑ,ԬԁԡԉԦ,ԜԏԊ,ԏԐ ԓԗ ԬԘԆԂԭԤԣԜԝԥ,ԏԆԍԂԁԞԔԠԒԍ ԧԔԓԓԛԍԧԆ ԫԚԍԢԟԮԆԥ,ԅ,ԬԢԚԊԡ,ԜԀԡԟԤԭԦԪԍԦ,ԅԅԙԟ,Ԗ ԪԟԘԫԄԓԔԑԍԈ Ԩԝ Ԋ,ԌԫԘԫԭԍ,ԅԈ Ԫ,ԘԯԑԉԥԡԔԍ

How to change the default border color of fbox? [duplicate]

Henj