mirror of
https://github.com/vikstrous/pirate-get
synced 2025-01-09 09:59:51 +01:00
Merge pull request #121 from m-kronberg/master
fix for empty href on links that ocasionally cause an uncaught exception
This commit is contained in:
commit
d86561b30c
@ -100,7 +100,10 @@ def parse_page(html):
|
|||||||
# parse the rows one by one (skipping headings)
|
# parse the rows one by one (skipping headings)
|
||||||
for row in table('tr')[1:]:
|
for row in table('tr')[1:]:
|
||||||
# grab info about the row
|
# grab info about the row
|
||||||
id_ = row.find('a', class_='detLink')['href'].split('/')[2]
|
row_link = row.find('a', class_='detLink')
|
||||||
|
if row_link is None:
|
||||||
|
continue
|
||||||
|
id_ = row_link['href'].split('/')[2]
|
||||||
seeds, leechers = [i.text for i in row('td')[-2:]]
|
seeds, leechers = [i.text for i in row('td')[-2:]]
|
||||||
magnet = row.find(lambda tag:
|
magnet = row.find(lambda tag:
|
||||||
tag.name == 'a' and
|
tag.name == 'a' and
|
||||||
@ -207,4 +210,4 @@ def copy_magnets(printer, chosen_links, results):
|
|||||||
clipboard_text += magnet + "\n"
|
clipboard_text += magnet + "\n"
|
||||||
printer.print('Copying {:X} to clipboard'.format(info_hash))
|
printer.print('Copying {:X} to clipboard'.format(info_hash))
|
||||||
|
|
||||||
pyperclip.copy(clipboard_text)
|
pyperclip.copy(clipboard_text)
|
||||||
|
Loading…
Reference in New Issue
Block a user