There is a working youtube Parser. Only links to videos are saved. How to add the ability to save the title and short description to each video link in the script?

# -*- coding: utf-8 -*- import urllib import re, os, sys def findyoutube(x): mas=[] sq='http://www.youtube.com/results?search_query='+urllib.quote(x) doc = urllib.urlopen(sq).read().decode('cp1251',errors='ignore') match = re.findall("\?v\=(.+?)\"", doc) if not(match is None): for ii in match: if(len(ii)<25): mas.append(ii) mas=dict(zip(mas,mas)).values() mas2=[] for y in mas: mas2.append('http://www.youtube.com/watch?v='+y) return mas2 print(findyoutube('болонская+удочка°')) with open('output.txt', 'w') as output: for i in findyoutube('болонская+удочка'): output.write(i+'\n') 
  • 2
    It will be easier to rewrite it completely than to add this feature to it. Look at BeautifulSoup . - Sergey Gornostaev

0