Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'subject:text': 0.05; 'differently': 0.07; 'subject:How': 0.09; 'python': 0.09; 'accepts': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'subject:python': 0.11; 'suggest': 0.11; 'subject: \n ': 0.16; 'subject:through': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'copied': 0.17; 'jan': 0.18; 'equivalent': 0.20; 'seems': 0.23; 'cc:2**1': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'realize': 0.27; 'start,': 0.27; 'probably': 0.29; 'returned': 0.30; 'subject: ?': 0.30; 'function': 0.30; 'received:google.com': 0.34; 'text': 0.34; 'received:209.85': 0.35; 'something': 0.35; 'cc:no real name:2**1': 0.36; 'quite': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'there,': 0.38; 'received:209.85.214': 0.39; 'skip:u 10': 0.60; 'hints': 0.65; 'webpage': 0.65; 'skip:n 30': 0.69; 'subject:get': 0.81; '2013': 0.84; 'addon': 0.84; 'not...': 0.84; 'selection,': 0.84; 'dennis': 0.91 Newsgroups: comp.lang.python Date: Tue, 8 Jan 2013 18:54:06 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=182.242.152.192; posting-account=Z1-aQQoAAADvnuKxr9sysEiuPIcBNfjX References: User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 182.242.152.192 MIME-Version: 1.0 Subject: Re: How to get the selected text of the webpage in chrome through python ? From: iMath To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org, d@davea.name X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 59 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357700573 news.xs4all.nl 6875 [2001:888:2000:d::a6]:52130 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36470 =E5=9C=A8 2013=E5=B9=B41=E6=9C=888=E6=97=A5=E6=98=9F=E6=9C=9F=E4=BA=8CUTC+8= =E4=B8=8B=E5=8D=889=E6=97=B611=E5=88=8630=E7=A7=92=EF=BC=8CDave Angel=E5=86= =99=E9=81=93=EF=BC=9A > On 01/08/2013 07:38 AM, Dennis Lee Bieber wrote: >=20 > > On Mon, 7 Jan 2013 20:20:28 -0800 (PST), iMath >=20 > > declaimed the following in gmane.comp.python.general: >=20 > > >=20 > >> How to get the selected text of the webpage in chrome through python ? >=20 > > Chrome is a browser, is it not... If you want to get the text in >=20 > > Python, you have to write the equivalent of a browser -- something that >=20 > > parses the returned HTML message, extracting the parts you want. >=20 >=20 >=20 > To get a selection, you can either wait till it's copied to the >=20 > clipboard, and get it from there, or you can write a addon for the >=20 > application. Since Chrome accepts addons, I suggest you research that >=20 > angle. Probably mozilla.org is the place to start, and function >=20 >=20 >=20 > nsISelectionController::GetSelection() might be some place to examine. >=20 >=20 >=20 > You might find some hints in >=20 > http://stackoverflow.com/questions/2671474/range-selection-and-mozilla >=20 >=20 >=20 >=20 >=20 > if you are going to work with the clipboard, realize that it works quite >=20 > differently from one OS to another, and even from one desktop manager to >=20 > another. >=20 >=20 >=20 > --=20 >=20 >=20 >=20 > DaveA It seems need Javascript to work it on . Unfortunately =EF=BC=8CI am only familiar with python .