[python-win32] change PAMIE to win32 interface problem
hello, currently im making some web scrap script. and i was choice PAMIE to use my script. actually im new to python and programming. so i have no idea ,if i use PAMIE,it really helpful to make script to relate with win32-python. ok my problem is , while im making script,i was encounter two probelm. first , i want to let work my script Beautifulsoup and PAMIE. so i was googled, and only i can found 1 hint. follow script is which i was found in google. but it not work for me. im using PAMIE3 version.even if i changed to pamie 2b version ,i couldn't make it working. from BeautifulSoup import BeautifulSoup Import cPAMIE url = 'http://www.cnn.com' ie = cPAMIE.PAMIE(url) bs = BeautifulSoup(ie.pageText()) and follow is my script. how to make it to work ? from BeautifulSoup import BeautifulSoup from PAM30 import PAMIE url = 'http://www.cnn.com' ie = PAMIE(url) bs = BeautifulSoup(ie.pageText()) my second problem is,while im making script,i think sometime i need normal IE interface. is it possible to change PAMIE's IE interface to just normal IE interface(InternetExplorer.Application)? i don't want to open new IE window to work with normal IE interface,want to continue work with current PAMIE's IE windows. sorry for my bad english Paul -- View this message in context: http://www.nabble.com/change-PAMIE-to-win32-interface-problem-tp26020853p26020853.html Sent from the Python - python-win32 mailing list archive at Nabble.com. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] how to use win32com with beautifulsoup or lxml?
hello... if anyone know..please help me ! i really want to know...i was searched in google lot of time. but can't found clear soultion. and also because of my lack of python knowledge. i want to use IE.navigate function with beautifulsoup or lxml.. if anyone know about this or sample. please help me! thanks in advance -- View this message in context: http://www.nabble.com/how-to-use-win32com-with-beautifulsoup-or-lxml--tp26044332p26044332.html Sent from the Python - python-win32 mailing list archive at Nabble.com. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] how to use win32com with beautifulsoup or lxml?
hello! thanks for your reply for example i want to extract some text in cnn website. such like 'Sponsored links' 'Money' text in cnn website. follow is sample what i want to make script. i want to add function into my script source which can extract such like text. thanks in advance ! :) import win32com.client from time import sleep from win32com.client import Dispatch import urllib,urllib2 from BeautifulSoup import BeautifulSoup ie = Dispatch("InternetExplorer.Application") ie.Visible = 1 ie.Navigate("http://www.cnn.com";) sleep(15) ie.Quit() ccurvey wrote: > > you can definitely use IE to and innerHTML() to get the HTML, then use > BeautifulSoup to parse the HTML. What are you having trouble with? > > > > On Sat, Oct 24, 2009 at 8:34 PM, elca wrote: > >> >> hello... >> if anyone know..please help me ! >> i really want to know...i was searched in google lot of time. >> but can't found clear soultion. and also because of my lack of python >> knowledge. >> i want to use IE.navigate function with beautifulsoup or lxml.. >> if anyone know about this or sample. >> please help me! >> thanks in advance >> -- >> View this message in context: >> http://www.nabble.com/how-to-use-win32com-with-beautifulsoup-or-lxml--tp26044332p26044332.html >> Sent from the Python - python-win32 mailing list archive at Nabble.com. >> >> ___ >> python-win32 mailing list >> python-win32@python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> > > > > -- > The source of your stress might be a moron > > ___ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -- View this message in context: http://www.nabble.com/how-to-use-win32com-with-beautifulsoup-or-lxml--tp26044332p26044523.html Sent from the Python - python-win32 mailing list archive at Nabble.com. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] how to use win32com with beautifulsoup or lxml?
Roberto Aguilar wrote: > > On Oct 24, 2009, at 6:17 PM, elca wrote: >> hello! >> thanks for your reply >> for example i want to extract some text in cnn website. >> such like 'Sponsored links' 'Money' text in cnn website. >> follow is sample what i want to make script. >> i want to add function into my script source which can extract such >> like >> text. >> thanks in advance ! :) > > Unless I'm missing something, why do you need Internet Explorer at > all? You can get the HTML using urllib2: > > import urllib2 > response = urllib2.urlopen('http://cnn.com/') > html = response.read() > > then extract what you're looking for with beautiful soup: > > from BeautifulSoup import BeautifulSoup > soup = BeautifulSoup(html) > > for content in soup.findAll('div', class="cnn_sectbincntnt2"): > if ' /money?cnn=yes import win32com.client >> from time import sleep >> from win32com.client >> import Dispatch >> import urllib,urllib2 >> from BeautifulSoup import BeautifulSoup >> ie = Dispatch("InternetExplorer.Application") >> ie.Visible = 1 >> ie.Navigate("http://www.cnn.com";) >> sleep(15) >> ie.Quit() >> >> >> ccurvey wrote: >>> >>> you can definitely use IE to and innerHTML() to get the HTML, then >>> use >>> BeautifulSoup to parse the HTML. What are you having trouble with? >>> >>> >>> >>> On Sat, Oct 24, 2009 at 8:34 PM, elca wrote: >>> >>>> >>>> hello... >>>> if anyone know..please help me ! >>>> i really want to know...i was searched in google lot of time. >>>> but can't found clear soultion. and also because of my lack of >>>> python >>>> knowledge. >>>> i want to use IE.navigate function with beautifulsoup or lxml.. >>>> if anyone know about this or sample. >>>> please help me! >>>> thanks in advance >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/how-to-use-win32com-with-beautifulsoup-or-lxml--tp26044332p26044332.html >>>> Sent from the Python - python-win32 mailing list archive at Nabble.com >>>> . >>>> >>>> ___ >>>> python-win32 mailing list >>>> python-win32@python.org >>>> http://mail.python.org/mailman/listinfo/python-win32 >>>> >>> >>> >>> >>> -- >>> The source of your stress might be a moron >>> >>> ___ >>> python-win32 mailing list >>> python-win32@python.org >>> http://mail.python.org/mailman/listinfo/python-win32 >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/how-to-use-win32com-with-beautifulsoup-or-lxml--tp26044332p26044523.html >> Sent from the Python - python-win32 mailing list archive at >> Nabble.com. >> >> ___ >> python-win32 mailing list >> python-win32@python.org >> http://mail.python.org/mailman/listinfo/python-win32 > > ___ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > > Hello, sorry for late reply.. actually im making web scraper. and scraping is no problem with javascript. after made scraper, i will add some other function and that time i will encounter many javascript, so why i try to use PAMIE or IE http://elca.pastebin.com/m52e7d8e0 i was attached current scraper script source. especially i want to change 'thepage = urllib.urlopen(theurl).read()' to PAMIE method. if possible ,you can check it and correct me? thanks in advance.. Regards -- View this message in context: http://www.nabble.com/how-to-use-win32com-with-beautifulsoup-or-lxml--tp26044332p26053433.html Sent from the Python - python-win32 mailing list archive at Nabble.com. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] closing not response win32 IE com interface
hello All, these day im making some script that use win32 IE com interface. one of problem is , my internet line is very slow, so sometimes my IE.navigate("http://www.example.com";) not response timely. it looks hang and open status, not complete status. so my IE.navigate function is not correctly working. anyone can help me? in that case ,how to close or restart my script from start. thanks in advance Paul -- View this message in context: http://old.nabble.com/closing-not-response-win32-IE-com-interface-tp26265067p26265067.html Sent from the Python - python-win32 mailing list archive at Nabble.com. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] IE interface PAMIE javascript click or win32 ie click
Hello, these day im making some script. i have encounter some problem with my script work. problem is i want to click emulate javascript on following site. http://news.naver.com/main/presscenter/category.nhn this site is news site. and everyday news content also changed, but javascript is not changed. for example i want to click javascript every inside 'li' element . how can i make it work with Pamie or win32com IE interface? thanks in advance http://www.bloter.net/wp-content/bloter_html/2009/11/11/19083.html 데스크톱 가상화 놓고 한판 대결…시트릭스와 MS vs. VM웨어, http://www.bloter.net/wp-content/bloter_html/2009/11/11/19105.html http://static.naver.com/newscast/2009//1615301154902609.jpg "블로그·카페로 PLM 정보 공유" thanks -- View this message in context: http://old.nabble.com/IE-interface-PAMIE-javascript-click-or-win32-ie-click-tp26302675p26302675.html Sent from the Python - python-win32 mailing list archive at Nabble.com. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] IE interface PAMIE javascript click or win32 ie click
Tim Roberts wrote: > > elca wrote: >> these day im making some script. >> >> i have encounter some problem with my script work. >> >> problem is i want to click emulate javascript on following site. >> >> http://news.naver.com/main/presscenter/category.nhn >> >> this site is news site. and everyday news content also changed, but >> javascript is not changed. >> >> for example i want to click javascript every inside 'li' element . >> >> how can i make it work with Pamie or win32com IE interface? >> > > I guess I'm not sure what you're after. You can certainly read the > HTML, find the links, and fetch the pages they point to, if you want to > get the individual news items. You could do that with urllib2, without > using IE at all. However, each section of that page points to a > different provider, so you'll have quite a job analyzing each one > separately. > > If you're trying to force a call to the "nds_tagging" or "clickcr" > functions, you would have to use the IE object model to inject a new >
[python-win32] how to control internet explorer new openning windows
Hello all, anyone can give me hint or something help ? my problem is ,while im making python script with internet explorer , i was encounter some new internet explorer windows. for example... if you click some link in following site. http://news.naver.com/main/presscenter/category.nhn maybe you will encounter new internet explorer window. my question is, first time i want to handle ie.navigate('http://news.naver.com/main/presscenter/category.nhn') and if i click and some new internet explorer is open, i would like some processing with opened page with new internet explorer window, and if complete i want to close new internet explorer window and go back first ie.navigate('http://news.naver.com/main/presscenter/category.nhn') and want to process click another link in ie.navigate('http://news.naver.com/main/presscenter/category.nhn') and continue process with new opened windows also and go back and so on. any help much appreciate..thanks in advance Paul -- View this message in context: http://old.nabble.com/how-to-control-internet-explorer-new-openning-windows-tp26314025p26314025.html Sent from the Python - python-win32 mailing list archive at Nabble.com. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] IE interface PAMIE javascript click or win32 ie click
Tim Roberts wrote: > > elca wrote: >> Hello, >> ""clickcr" functions, you would have to use the IE object model to inject >> a >> new tag into the page that calls the appropriate function" >> >> this is actually what i want to do function. :) >> if possible would help me how to make it work. >> > > I've never done this, but if you fetch the Document property from the IE > object, you have exactly the same thing as the "document" object that > the page's Javascript sees. So, I think you should be able to say > something like this: > > doc = ieObject.Document > doc.write( "<script> clickcr( xxx, yyy, zzz ); " ); > > There may be some COM tricks to play here. The Document object can be > either IHTMLDocument or IHTMLDocument2 or IHTMLDocument3 or ...4 or ...5 > or ...6. You'll need at least IHTMLDocument2 in order to use these > methods. Plus, the "write" method actually takes a COM SAFEARRAY. I'm > not exactly sure how that's exposed in Python. > > You're going to have to do some reading about this, both about the > win32com toys, and about the InternetExplorer automation interface, and > about the IHTMLDocument2 interface. > > -- > Tim Roberts, t...@probo.com > Providenza & Boekelheide, Inc. > > ___ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > > hello, thanks for your help , maybe i need to study some more about many related with win32 and so on thanks again Paul -- View this message in context: http://old.nabble.com/IE-interface-PAMIE-javascript-click-or-win32-ie-click-tp26302675p26345290.html Sent from the Python - python-win32 mailing list archive at Nabble.com. ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32