Skip to content

Commit

Permalink
Update bj2feeder.py
Browse files Browse the repository at this point in the history
Fixed a bug where it don't download files with unicode characters.
Corrigido bug onde não baixava arquivos com caracteres em unicode.
  • Loading branch information
pulgalipe committed Jun 20, 2014
1 parent c185c9a commit 372275c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions bj2feeder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#Importa as bibliotecas necessarias
# -*- coding: utf-8 -*-
#!/usr/bin/python

#Importa as bibliotecas necessárias
import feedparser, urllib2, os, re

#-----------------------------------#
Expand All @@ -11,7 +14,7 @@
#Tenha certeza que tem direito para escrever no diretório

#Define os releases que deverão ser baixados
#Não se esqueça de colocar o nome de cada release separado por vígula e dentro de aspas duplas
#Não se esqueça de colocar o nome de cada release separado por vírgula e dentro de aspas duplas
RELEASES = [ "Release1|Release2|Release3" ]
#Ex: RELEASES = [ "Game.of.Thrones|Spiderman|Da.Vinci" ]

Expand All @@ -25,8 +28,8 @@
#----NAO EDITE NADA A PARTIR DAQUI---#
#------------------------------------#

#Define a URL do Tracker que será acessado pelo feedparser
#Utilize o método "feedparser.parse" sempre que precisar acessar um feed
#Define a URL do Tracker que sera acessado pelo feedparser
#Utilize o metodo "feedparser.parse" sempre que precisar acessar um feed
bjurl = 'http://bj2.me/rss.php'
bjurl = feedparser.parse( bjurl )

Expand All @@ -41,7 +44,8 @@
link = link.replace( 'detalhes', 'download' )
if re.search( RELEASES[ rel ], title, re.I ):
print( 'Baixando Torrent: ' + title )
title = title.encode('ascii', 'ignore')
print( 'Link: ' + link )
os.system( "wget -q --header \"Cookie: pass=" + str( PASS ) + ";uid=" + str( UID ) + "\" -O \"" + title + ".torrent\" " + link )
os.system( "wget -q --header \"Cookie: pass=" + PASS + ";uid=" + UID + "\" -O \"" + title + ".torrent\" " + link )
print( 'Download concluido.\n' )
print( 'Script finalizado com sucesso!' )

0 comments on commit 372275c

Please sign in to comment.