Recently Crunchyroll added two new series exclusively to their portuguese/spanish regions: Seiken no Blacksmith and Dance in the Vampire Bund.
Since those titles are unavailable on the USA, both series wheren't showing up in the plugin, so I played a little and added another option to the settings page: Lineup region.
If it's set to US, it will stay as usual.
If it's set to BR, ES or FR, it will display only the titles that have subs in the corresponding language, including the titles that may be exclusive for that region.
Unlike the US page that several titles has been translated to english, most of the titles in Brazil use the japanese names, but for some weird reason, they are alphabetically ordered according to the english names on the main listing ("Daiya no A" was coming before "Ai-Mai-Mi", for example), so I had to add a sorting to the title listing to make it really in alphabetical order.
I also noticed that Naruto Shippuuden, Hunter X Hunter, Kuroko, etc, was showing up duplicated in the main list or always being showed in the end of every genre list, then I founnd out that the scrapper was also getting the videos from the "Popular Series" on the sidebar widget, so I changed the
and then only the right items are showing up.
Here's the diffs, feel free to use or modify it.
Code:
--- D:\XBMC_testes\!original\plugin.video.crunchyroll-takeout\resources\lib\crunchy_scraper.py Tue Oct 29 14:57:17 2013
+++ D:\XBMC_testes\portable_data\addons\plugin.video.crunchyroll-takeout\resources\lib\crunchy_scraper.py Tue Oct 29 22:14:19 2013
@@ -17,6 +17,7 @@
from BeautifulSoup import BeautifulSoup
__settings__ = sys.modules[ "__main__" ].__settings__
+lineupRegion = __settings__.getSetting("lineupRegion")
class _Info:
@@ -38,10 +39,12 @@
item = {}
print "Crunchyroll Takeout: --> in parseTitleList"
soup_title = BeautifulSoup(feed_title)
- queue_list = soup_title.findAll('li',attrs={"itemtype":"http://schema.org/TVSeries"})
+ queue_list = soup_title.findAll('li',attrs={"class":"hover-bubble group-item"})
+ # queue_list = soup_title.findAll('li',attrs={"itemtype":"http://schema.org/TVSeries"})
+ queue_lists = sorted(queue_list, key=lambda elem: elem.text.lower())
num_series = len(queue_list)
print "Crunchyroll Takeout: -->number of found series "+str(num_series)
- for queue_series in queue_list:
+ for queue_series in queue_lists:
if queue_series is not None:
#print queue_series
item['name'] = queue_series.a['title']
@@ -54,7 +57,8 @@
print "Crunchyroll Takeout: --> in parseSpBoxScrappedSeries"
item = {}
soup_title = BeautifulSoup(feed)
- queue_list = soup_title.findAll('li',attrs={"itemtype":"http://schema.org/TVSeries"})
+ queue_list = soup_title.findAll('li',attrs={"class":"hover-bubble group-item"})
+ # queue_list = soup_title.findAll('li',attrs={"itemtype":"http://schema.org/TVSeries"})
num_series = len(queue_list)
print "Crunchyroll Takeout: -->number of found series "+str(num_series)
for queue_series in queue_list:
@@ -127,6 +131,19 @@
self.episodes_list = []
+ def getRegion(self):
+ # print 'CRUNCHYROLL: --> Lineup: '+lineupRegion
+ if lineupRegion == "0":
+ lineupRegions = "en-us"
+ if lineupRegion == "1":
+ lineupRegions = "pt-br"
+ if lineupRegion == "2":
+ lineupRegions = "es-es"
+ if lineupRegion == "3":
+ lineupRegions = "fr-fr"
+ print 'CRUNCHYROLL: --> Using lineup from: '+lineupRegions
+ return lineupRegions
+
def getEpisodeListing(self, url):
full_url = "http://www.crunchyroll.com"+url
id = url.replace('/','')
@@ -137,7 +154,8 @@
rssFeed = usock.read()
else:
opener = urllib2.build_opener()
- opener.addheaders = [('User-Agent','curl/7.16.3 (Windows build 7600; en-US; beta) boxee/0.9.21.12594'),('Accept-Encoding','deflate, gzip'),('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7'),('Accept-Language','en-us,en;q=0.5')]
+ opener.addheaders = [('User-Agent','curl/7.16.3 (Windows build 7600; en-US; beta) boxee/0.9.21.12594'),('Accept-Encoding','deflate, gzip'),('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7'),('Accept-Language',self.getRegion()+',en;q=0.5')]
+ # opener.addheaders = [('User-Agent','curl/7.16.3 (Windows build 7600; en-US; beta) boxee/0.9.21.12594'),('Accept-Encoding','deflate, gzip'),('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7'),('Accept-Language','en-us,en;q=0.5')]
usock = opener.open(full_url)
rssFeed = usock.read()
if usock.headers.get('content-encoding', None) == 'gzip':
@@ -161,7 +179,8 @@
rssFeed = usock.read()
else:
opener = urllib2.build_opener()
- opener.addheaders = [('User-Agent','curl/7.16.3 (Windows build 7600; en-US; beta) boxee/0.9.21.12594'),('Accept-Encoding','deflate, gzip'),('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7'),('Accept-Language','en-us,en;q=0.5')]
+ opener.addheaders = [('User-Agent','curl/7.16.3 (Windows build 7600; en-US; beta) boxee/0.9.21.12594'),('Accept-Encoding','deflate, gzip'),('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7'),('Accept-Language',self.getRegion()+',en;q=0.5')]
+ # opener.addheaders = [('User-Agent','curl/7.16.3 (Windows build 7600; en-US; beta) boxee/0.9.21.12594'),('Accept-Encoding','deflate, gzip'),('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7'),('Accept-Language','en-us,en;q=0.5')]
usock = opener.open(full_url)
rssFeed = usock.read()
if usock.headers.get('content-encoding', None) == 'gzip':
@@ -187,7 +206,8 @@
rssFeed = usock.read()
else:
opener = urllib2.build_opener()
- opener.addheaders = [('User-Agent','curl/7.16.3 (Windows build 7600; en-US; beta) boxee/0.9.21.12594'),('Accept-Encoding','deflate, gzip'),('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7'),('Accept-Language','en-us,en;q=0.5')]
+ opener.addheaders = [('User-Agent','curl/7.16.3 (Windows build 7600; en-US; beta) boxee/0.9.21.12594'),('Accept-Encoding','deflate, gzip'),('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7'),('Accept-Language',self.getRegion()+',en;q=0.5')]
+ # opener.addheaders = [('User-Agent','curl/7.16.3 (Windows build 7600; en-US; beta) boxee/0.9.21.12594'),('Accept-Encoding','deflate, gzip'),('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7'),('Accept-Language','en-us,en;q=0.5')]
usock = opener.open(full_url)
rssFeed = usock.read()
if usock.headers.get('content-encoding', None) == 'gzip':
@@ -242,7 +262,8 @@
rssFeed = usock.read()
else:
opener = urllib2.build_opener()
- opener.addheaders = [('User-Agent','curl/7.16.3 (Windows build 7600; en-US; beta) boxee/0.9.21.12594'),('Accept-Encoding','deflate, gzip'),('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7'),('Accept-Language','en-us,en;q=0.5')]
+ opener.addheaders = [('User-Agent','curl/7.16.3 (Windows build 7600; en-US; beta) boxee/0.9.21.12594'),('Accept-Encoding','deflate, gzip'),('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7'),('Accept-Language',self.getRegion()+',en;q=0.5')]
+ # opener.addheaders = [('User-Agent','curl/7.16.3 (Windows build 7600; en-US; beta) boxee/0.9.21.12594'),('Accept-Encoding','deflate, gzip'),('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7'),('Accept-Language','en-us,en;q=0.5')]
usock = opener.open(full_url)
rssFeed = usock.read()
if usock.headers.get('content-encoding', None) == 'gzip':