View Single Post
Old 08-07-2020, 02:02 PM   #12
biffhero
Junior Member
biffhero began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Aug 2020
Device: kobo libre h20
OK, I'm starting to understand how this stuff works. I think I'm making progress, but I'm not sure.

The base URL has changed.

feeds = [
('Top Headlines', 'http://sports.espn.go.com/espn/rss/news'),
'http://sports.espn.go.com/espn/rss/nfl/news',
'http://sports.espn.go.com/espn/rss/nba/news',
'http://sports.espn.go.com/espn/rss/mlb/news',
'http://sports.espn.go.com/espn/rss/nhl/news',
'http://sports.espn.go.com/espn/rss/golf/news',
'http://sports.espn.go.com/espn/rss/rpm/news',
'http://sports.espn.go.com/espn/rss/tennis/news',
'http://sports.espn.go.com/espn/rss/boxing/news',
'http://soccernet.espn.go.com/rss/news',
'http://sports.espn.go.com/espn/rss/ncb/news',
'http://sports.espn.go.com/espn/rss/ncf/news',
'http://sports.espn.go.com/espn/rss/ncaa/news',
'http://sports.espn.go.com/espn/rss/outdoors/news',
# 'http://sports.espn.go.com/espn/rss/bassmaster/news',
'http://sports.espn.go.com/espn/rss/oly/news',
'http://sports.espn.go.com/espn/rss/horse/news'
]


Therefore, in print_version() we need

return 'http://sports.espn.go.com/espn/print?' + match.group(1) + '&type=story'


However, where I'm getting confused is where we get "match" setup.

When we land inside of print_version, the variable "url" is holding the number. For instance, this is a good URL. https://www.espn.com/espn/print?id=29581539&type=story But the 'url' variable is coming in with '29581539', and the 'match' variable is completely empty.

My current attempt has this in print_version(), which isn't working.

def print_version(self, url):
if 'eticket' in url:
return url.partition('&')[0].replace('story?', 'print?')
match = re.search(r'story\?(id=\d+)', url)
self.log.debug('url: %s' % (url))
self.log.debug('match: %s' % (match.group(1)))
match = 1
articleId = url
if match and 'soccernet' not in url and 'bassmaster' not in url:
# return 'http://sports.espn.go.com/espn/print?' + match.group(1) + '&type=story'

self.log.debug('i: %s' % (match.group(1)))

# https://www.espn.com/espn/print?id=29581539&type=story
# return 'http://www.espn.com/espn/print?' + match.group(1) + '&type=story'



I'll keep applying head to wall, but if this helps someone else get closer, that's good.
biffhero is offline   Reply With Quote