Check-in [3aa88ef2ca]
Overview
| Comment: | Support for LiveRadio.UK (in addition to .IE) |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
3aa88ef2ca508e80ff07fc96243f1c26 |
| User & Date: | mario on 2020-05-14 23:05:57 |
| Other Links: | manifest | tags |
Context
|
2020-05-14
| ||
| 23:08 | Adapt yelp pages to plugin deprecations (dirble, streamlicensing, tuner2, etc.) and liveradio now being standard channel. check-in: fcd345af8a user: mario tags: trunk | |
| 23:05 | Support for LiveRadio.UK (in addition to .IE) check-in: 3aa88ef2ca user: mario tags: trunk | |
| 23:05 | Add binary JPEG detection \xFF\xD8\xFF magic bytes. check-in: a888486bae user: mario tags: trunk | |
Changes
Modified channels/liveradio.py from [662509f581] to [68701f5e2f].
1 2 | # encoding: UTF-8 # api: streamtuner2 | | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# encoding: UTF-8
# api: streamtuner2
# title: LiveRadio
# description: Irish/worldwide radio station directory
# url: http://liveradio.ie/
# version: 0.4
# type: channel
# category: radio
# config: -
# { name: liveradio_tld, value: ie, type: select, select: ie=LiveRadio.ie|uk=LiveRadio.uk, description: Website to fetch from. }
# png:
# iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABB0lEQVR4nLWTQUpDMRCGv0lregDBI3gAfW/hRrp8ZOMh5PUMXkFcu7EbTxHd
# CC4EhfQkQg/QR5txYQqvMdVHwdnMZJj555uQwH+YurpaNZUOqTWl5i5qGIusDxIAZgBGuBhCsiOgrq7WUa+tkReAjepHystQgmn8zt0As40y
# skYa4HwfSS5w2otd8svtWurqHyvnCZcXAHRRW7v8nANnq6bSPk0ucFQS+M3G2fkduMqLrJF5d3zSTnyYATsXmhO89WLfix8A1NWjvwhek5+m
# praLGibPC8knFwnEh4U1ct9FvUvoLk0uPbjiCgCPyd+KD0/WyKX4EPcJFLG2/8EaMeLDoE91sH0B3ERWq2CKMoYAAAAASUVORK5CYII=
# priority: standard
# extraction-method: regex, dom, action-handler
#
# LiveRadio.ie, based in Ireland, is a radio station directory. It provides
# genre or country browsing (not in this plugin). Already lists over 5550
# stations (more unique selections). Also accepts user submissions.
#
# This channel loads their station logos as favicons. Even allows to utilize
# the live search function.
|
| ︙ | ︙ | |||
47 48 49 50 51 52 53 54 55 56 |
img_resize = 32
# data store
categories = ["Top 20"]
catmap = {"Top 20":"top-20"}
base = "http://www.liveradio.ie/"
# Extract genre links and URL aliases (e.g. "Top 20" maps to "/top-20")
def update_categories(self):
| > > > > > > > > > | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
img_resize = 32
# data store
categories = ["Top 20"]
catmap = {"Top 20":"top-20"}
base = "http://www.liveradio.ie/"
# override meta based on TLD setting (.ie / .uk)
def init2(self, parent):
if not "liveradio_tld" in conf:
conf.liveradio_tld = "ie"
self.base = "http://www.liveradio.{}/".format(conf.liveradio_tld)
self.meta["url"] = self.base
#self.meta["title"] = "LiveRadio.{}".format(conf.liveradio_tld)
# Extract genre links and URL aliases (e.g. "Top 20" maps to "/top-20")
def update_categories(self):
html = ahttp.get(self.base + "genres")
self.categories = ["Top 20"]
for row in re.findall(r"""<a href="/(stations/genre-[\w-]+)">([^<]+)</a>""", html):
self.categories.append(unhtml(row[1]))
self.catmap[unhtml(row[1])] = unhtml(row[0])
# Fetch entries
|
| ︙ | ︙ | |||
95 96 97 98 99 100 101 |
# ยท img url is embedded
# ยท keep station ID as `urn:liveradion:12345`
#
def rx_extract(self, html):
r = []
ls = re.findall("""
itemtype="http://schema.org/RadioStation"> .*?
| | | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# ยท img url is embedded
# ยท keep station ID as `urn:liveradion:12345`
#
def rx_extract(self, html):
r = []
ls = re.findall("""
itemtype="http://schema.org/RadioStation"> .*?
href="(?:https?://www.liveradio.\w+)?/stations/([\w-]+) .*?
<img\s+src="/(files/images/[^"]+)" .*?
="country">([^<]+)< .*?
itemprop="name"><a[^>]+>([^<]+)</a> .*?
class="genre">([^<]+)<
""", html, re.X|re.S)
for row in ls:
#log.DATA(row)
|
| ︙ | ︙ |