Skip to content

Commit f511557

Browse files
definitely removed TotallyCoolPix and NewYorkTimesLens
1 parent 625faee commit f511557

2 files changed

Lines changed: 0 additions & 145 deletions

File tree

lib/scrapers.py

Lines changed: 0 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
'TimePhotography',
4545
'ReadingthePictures',
4646
'Reddit',
47-
'TotallyCoolPix',
48-
'NewYorkTimesLens',
4947
)
5048

5149

@@ -352,147 +350,6 @@ def _get_photos(self, album_url):
352350
return self._photos[album_url]
353351

354352

355-
class TotallyCoolPix(BasePlugin):
356-
357-
_title = 'TotallyCoolPix.com'
358-
359-
def _get_albums(self):
360-
self._albums = []
361-
url = 'https://totallycoolpix.com'
362-
html = self._get_html(url)
363-
albums = parseDOM( html, 'div', {'class': 'item'} )
364-
for id, album in enumerate(albums):
365-
if not parseDOM( album, 'a', {'class': 'open'} ):
366-
continue
367-
title = parseDOM( album, 'h2' )[0]
368-
album_url = parseDOM( album, 'a', ret='href' )[0]
369-
p = parseDOM( album, 'p' )
370-
description = p[0].replace( '<br />', '' ) if p else ''
371-
# add date to description:
372-
description = stripTags( parseDOM( parseDOM( album, 'li' ), 'a')[0] ) + "\n" + description
373-
pic = parseDOM( album, 'img', ret='src' )[0]
374-
self._albums.append({
375-
'title': title,
376-
'album_id': id,
377-
'pic': pic,
378-
'description': description,
379-
'album_url': album_url}
380-
)
381-
return self._albums
382-
383-
def _get_photos(self, album_url):
384-
self._photos[album_url] = []
385-
386-
html = self._get_html(album_url)
387-
for id, photo in enumerate( parseDOM( html, 'div', attrs={'class': 'image'}) ):
388-
img = parseDOM( photo, 'img', ret='src' )[0]
389-
if not img:
390-
continue
391-
if id == 0:
392-
album_title = parseDOM( photo, 'h2' )[0]
393-
# jump first entry as it is a repetition of the album description
394-
continue
395-
description = stripTags(self._parser.unescape(parseDOM( html, 'p', attrs={'class': 'desc'} )[0]))
396-
else:
397-
try:
398-
description = self._parser.unescape(parseDOM( photo, 'p', {'class': 'info-txt'} )[0])
399-
except:
400-
description = ''
401-
self._photos[album_url].append({
402-
'title': '%d - %s' % (id + 1, album_title),
403-
'album_title': album_title,
404-
'photo_id': id,
405-
'pic': img,
406-
'description': description,
407-
'album_url': album_url
408-
})
409-
if (id==0):
410-
# possibly a video:
411-
video = parseDOM( html, 'iframe', ret='src' )[0]
412-
self.log('possible video = ' + video)
413-
if re.match(r'.+youtube.com/.+', video):
414-
video_id = re.sub('.+/', '', video)
415-
self.log('youtube video = ' + video_id)
416-
xbmc.executebuiltin('PlayMedia(plugin://plugin.video.youtube/play/?video_id=' + video_id + ')')
417-
elif re.match(r'.+vimeo.com/.+', video):
418-
video_id = re.sub('.+/', '', video)
419-
self.log('vimeo video = ' + video_id)
420-
xbmc.executebuiltin('PlayMedia(plugin://plugin.video.vimeo/play/?video_id=' + video_id + ')')
421-
# if no match: previous processing have retrieved images
422-
return self._photos[album_url]
423-
424-
425-
class NewYorkTimesLens(BasePlugin):
426-
427-
_title = 'NewYorkTimes.com: Lens Blog'
428-
429-
def _get_albums(self):
430-
self._albums = []
431-
home_url = 'https://www.nytimes.com'
432-
url = home_url + '/section/lens'
433-
html = self._get_html(url)
434-
for id, album in enumerate( parseDOM( html, 'li', attrs={ 'class': 'css-[^"\']+' } ) ):
435-
title = parseDOM( album, 'h2' )
436-
if not title:
437-
continue
438-
439-
album_url = parseDOM( album, 'a', ret='href' )[0]
440-
picture = parseDOM( album, 'img', ret='src' )[0]
441-
image = parseDOM( album, 'img', ret='srcSet' )[0]
442-
if re.search( r'Medium', image ):
443-
image = image.split(',')
444-
for picture in image:
445-
if re.search( r'Medium', picture ):
446-
picture = re.search( r'^[^\?]+', picture).group()
447-
break
448-
description = parseDOM( album, 'p' )[0].encode('utf-8', 'ignore')
449-
date = re.search( r'/(20\d{2}/\d{2}/\d{2})/' , album_url )
450-
if ( date ):
451-
description = date.group(1).encode('utf-8', 'ignore') + "\n" + description
452-
self._albums.append({
453-
'title': stripTags( title[0] ),
454-
'album_id': id,
455-
'pic': picture,
456-
'description': description,
457-
'album_url': home_url + album_url
458-
})
459-
460-
return self._albums
461-
462-
def _get_photos(self, album_url):
463-
self._photos[album_url] = []
464-
465-
html = self._get_html(album_url)
466-
slide_html = parseDOM( html, 'figure', attrs={ 'class': '[^\'"]*?css-[^\'"]+' }, ret='item[IDid]{2}' )
467-
summaries = parseDOM( html, 'div', attrs={ 'class': '[^\'"]*?StoryBodyCompanionColumn[^\'"]*' } )
468-
for id, slide in enumerate( parseDOM( html, 'figure', attrs={ 'class': '[^\'"]*?css-[^\'"]+' } ) ):
469-
picture = slide_html[id]
470-
if not picture:
471-
continue
472-
description = ''
473-
for desc in enumerate( parseDOM( parseDOM( slide, 'figcaption' ), 'span', attrs={'class':'[^\'"]*'} ) ):
474-
description = description + "\n" + stripTags( desc[1].replace( '</span>', "\n" ) )
475-
title = parseDOM( parseDOM( html, 'h1' ), 'span' )[0]
476-
self.log( str( len(summaries)/len(slide_html) ) )
477-
self.log( str( (1 if len(summaries)/len(slide_html)<1 else int(len(summaries)/len(slide_html))) ) )
478-
try:
479-
summary = stripTags( u''.join( parseDOM(
480-
summaries[id*(1 if len(summaries)/len(slide_html)<1 else int(len(summaries)/len(slide_html)))+1],
481-
'p', attrs={'class': 'css-1ygdjhk e2kc3sl0'} ) ) )
482-
except:
483-
summary = ''
484-
self._photos[album_url].append({
485-
'title': title,
486-
'album_title': title,
487-
'photo_id': id,
488-
'pic': picture,
489-
'description': description[1:] + summary,
490-
'album_url': album_url
491-
})
492-
493-
return self._photos[album_url]
494-
495-
496353
class Reddit(BasePlugin):
497354

498355
_title = 'Reddit'

resources/settings.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,5 @@
2424
<setting id="enable_TimePhotography" type="bool" label="32405" default="true"/>
2525
<setting id="enable_ReadingthePictures" type="bool" label="32408" default="true"/>
2626
<setting id="enable_Reddit" type="bool" label="32407" default="true"/>
27-
<setting id="enable_TotallyCoolPix" type="bool" label="32404" default="false"/>
28-
<setting id="enable_NewYorkTimesLens" type="bool" label="32406" default="false"/>
2927
</category>
3028
</settings>

0 commit comments

Comments
 (0)