开发者

How do I search for a link in this web site (on Linux)?

开发者 https://www.devze.com 2023-03-31 08:38 出处:网络
I\'m trying to write a xbmc plugin for mako.co.il (I know there is a xbmako but I can\'t install it on linux). When I try to re开发者_运维问答gexp the episodes site I don\'t get any result. I tried th

I'm trying to write a xbmc plugin for mako.co.il (I know there is a xbmako but I can't install it on linux). When I try to re开发者_运维问答gexp the episodes site I don't get any result. I tried this web page and I could find the link using a href=".*?">\n\t*<img

Here is a test site: http://www.mako.co.il/mako-vod-keshet/aharoni_cooks

And here is the tutorial: http://wiki.xbmc.org/index.php?title=HOW-TO_write_plugins_for_XBMC

I think it has something to do with the line break, the solution I thought about is to search for anything of the which has a href=".*?"> followed by anything, followed by \t<img

Edit:

OK, so I try to do this dom xml parsing style. I am now stuck because that in line 101 I have a (javascript?) part with a for loop which the parser thinks to be a tag...


The site uses CR-LF for line breaks, but your regex assumes they are LF. You could deal with this by checking for both styles:

a href=".*?">\r?\n\t*<img


Use a DOM parser

You should not manually parse the HTML file. Instead, try using a DOM parser. I suggest minidom or ElementTree for general Python code.

XBMC

Since you mention XBMC, I suggest that you use the Parsedom plugin, which is designed for this purpose.

The plugin page shows you how to list all the a tags, or to select certain ones.

0

精彩评论

暂无评论...
验证码 换一张
取 消