fork download
  1. from grab import Grab
  2.  
  3. domen = "http://w...content-available-to-author-only...r.org"
  4. link = "http://w...content-available-to-author-only...r.org/top"
  5. monitoring_text = "Ex Machina"
  6. raw_torrent_links_css_selector = "a[href^='/torrent/']"
  7. found = {}
  8. count = 1
  9.  
  10. g = Grab()
  11. g.go(link)
  12. raw_torrent_links = g.css_list(raw_torrent_links_css_selector)
  13.  
  14. for torrent in raw_torrent_links:
  15. if torrent.text != None and (torrent.text.lower()).find(monitoring_text.lower())!= -1:
  16. torrent_page = domen+torrent.attrib['href']
  17. print(torrent_page)
  18. link_to_torrent_file = torrent(torrent_page, g) # TypeError: 'HtmlElement' object is not callable. отдельно работает нормально
  19. found[count] = [torrent.text, torrent_page]
  20. count += 1
  21.  
  22. def torrent(url, grab_obj):
  23. grab_obj.go(url)
  24. rawtorrent = grab_obj.doc.select("//div[@id='download']/a[2]")
  25. return rawtorrent.attr('href')
Runtime error #stdin #stdout #stderr 0.02s 8688KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 1, in <module>
ImportError: No module named 'grab'