Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #302 from zmwangx/youtube-metadata-extraction
Browse files Browse the repository at this point in the history
Fix metadata extraction of YouTube results
  • Loading branch information
jarun authored Nov 16, 2019
2 parents 10d88bb + ffe89b0 commit a523c12
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion googler
Original file line number Diff line number Diff line change
Expand Up @@ -2202,11 +2202,14 @@ class GoogleParser(object):
matched_keywords = []
abstract = ''
for childnode in div_g.select('.st').children:
if 'f' in childnode.classes:
# .f is handled as metadata instead.
continue
if childnode.tag == 'b' and childnode.text != '...':
matched_keywords.append({'phrase': childnode.text, 'offset': len(abstract)})
abstract = abstract + childnode.text.replace('\n', '')
try:
metadata = div_g.select('.slp').text
metadata = div_g.select('.f').text
metadata = metadata.replace('\u200e', '').replace(' - ', ', ').strip()
except AttributeError:
metadata = None
Expand Down

0 comments on commit a523c12

Please sign in to comment.