pagesource command
#1
What's the pagesource command? I want to code a 'find' command, for example:

For urls, it's url.find('whateverneeded')=1:

What is it for pagesource? I'm trying to do a command for finding something in the page source.
Reply
#2
huh? not sure what you mean, but reading a page into a string is easy using urllib or urllib2

page = urllib2.urlopen('http://python.org/').read()

then you would simply do page.find('whatyouneed') ...
Reply
#3
I mean reading the page source, for example, right clicking on a page and clicking view page source in Firefox.
Reply
#4
what has that with python programming to do?

please place those questions somewhere else.

this forum is for XBMC usage/support.
Reply
#5
Maybe I'm not expressing myself clearly, sorry. I mean, is there a way to have xbmc read the pagesource through python?
Reply
#6
I think I understand what you want.
If yoy take te example of blittan, in pyhton the following line:
Code:
page = urllib2.urlopen('http://python.org/').read()

Will give you the source code in the variable page. His econd line ws to show you how to find a string in the webpage (which is only source code)
It is exactly what he explained to you. Don't forget python is not a web browser. What go through the network is only source code, pictures ...
Image
_____________________________

Repositories Installer: select and install unofficial repositories / TAC.TV: watch videos on TAC.TV
Installer Passion-XBMC: Download and Install Add-ons (pre-Dharma only)

Image
Reply
#7
exiledx Wrote:Maybe I'm not expressing myself clearly, sorry. I mean, is there a way to have xbmc read the pagesource through python?
Let's try again.
blittan Wrote:huh? not sure what you mean, but reading a page into a string is easy using urllib or urllib2

page = urllib2.urlopen('http://python.org/').read()

then you would simply do page.find('whatyouneed') ...

Please at least try that to see if it is what you want.
Always read the XBMC online-manual, FAQ and search and search the forum before posting.
For troubleshooting and bug reporting please read how to submit a proper bug report.

If you're interested in writing addons for xbmc, read docs and how-to for plugins and scripts ||| http://code.google.com/p/xbmc-addons/
Reply

Logout Mark Read Team Forum Stats Members Help
pagesource command0