python - How to store torrent links in a database? -


i have python list in spider containing magnet torrent list. how store list/magnet torrent in database fields ? code :

class myspider(basespider):      name = "myspider"     allowed_domains = ["thepiratebay.se"]     base_url = "http://www.thepiratebay.se/search/%s/"     start_urls = []      def __init__(self, *args, **kwargs):         movies = movie.objects.all()         movie in movies:             self.start_urls.append(self.base_url % movie.name)         super(myspider, self).__init__(*args, **kwargs)      def parse(self, response):         self.log('hi, item page! %s' % response.url)         hxs = htmlxpathselector(response)         items = hxs.select('//table/tr/td[contains(@class, "detname")]')         item = items         item_name = hxs.select('//a[@class="detlink"]/text()').extract()[1]         print item_name  #list containing movie names               torrent_link = hxs.select('//a[@title="download torrent using magnet"]/@href').extract()[1]         print torrent_link # torrent_link contains list of torrent links 

now want save these links in database ??? how ???

assuming have no experience of database programming python i'd suggest google "python database tutorial" (i'd suggest starting sqlite) , try following , adapting current script.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -