Questions tagged [pyquery]

pyquery is a jquery-like library for python that allows you to make jquery queries on xml documents.

PyQuery uses lxml for fast XML and HTML manipulation.

It allows you to make jQuery-style CSS-selector queries on XML/HTML documents. The API is intended to match jQuery's API whenever possible, though it has been made more Pythonic where appropriate

It can be used for many purposes. The main idea is to use it for templating with pure http templates that you modify using pyquery. I can also be used for web scrapping or for theming applications with Deliverance.

Read more

92 questions
0
votes
1 answer

PyQuery and PDFQuery text extraction from next sibling in XML or PDF

I'm trying to extract information from a PDF using the package PDFQuery. The information is not in the same location every time so I need to have a query tag. First, I wrote the function: def clean_text_data(text): return text.split(':')[1] I…
Alex
  • 61
  • 4
0
votes
1 answer

PyQuery won't return elements on a page

I've set up a Python script to open this web page with PyQuery. import requests from pyquery import PyQuery url = "http://www.floridaleagueofcities.com/widgets/cityofficials?CityID=101" page = requests.get(url) pqPage = PyQuery(page.content) But…
Username
  • 2,727
  • 4
  • 48
  • 89
0
votes
1 answer

how get groups last column element

How use css selector find the last element in same elements each line on python? I'm using package pyquery. I has tried tr td:nth-child(2) .score.fill:last-child, tr td:nth-child(2) .score.fill:nth-last-child(1). all failed. …
zzzz zzzz
  • 128
  • 11
0
votes
1 answer

PyQuery html how to choose ( second tag ,nth-child)

a='''

''' from pyquery import PyQuery html = PyQuery(a) 1.Questions I try to get…
kovac
  • 147
  • 1
  • 10
0
votes
2 answers

Getting elements that have specific attributes by pyquery

I have something like this in HTML page:
  • Value1
  • Value2
Chalist
  • 2,676
  • 5
  • 35
  • 61
0
votes
1 answer

How to extract values from an infinite scroll webpage with python?

I am unable to extract any data from this website. This code works for other sites. Also, this website is extendable if a registered user scrolls down. How can I extract data from the table from such a website? from pyquery import PyQuery as…
prashanth manohar
  • 481
  • 1
  • 11
  • 26
0
votes
1 answer

Pyquery get element count

In the python library pyquery, the query result is a object, not a dictionary or an array. So how to get the query result count of result in this example? dom = '

Whoah!

nipunasudha
  • 1,885
  • 2
  • 17
  • 40
0
votes
1 answer

global variable error using Manager in multiprocessing

Here is my code, the key point is to share the tweetsvariable in multiprocessing: import urllib,urllib2,json,re,datetime,sys,cookielib from .. import models from pyquery import PyQuery from multiprocessing import Process, Pool, Queue, Manager import…
exteral
  • 749
  • 2
  • 9
  • 29
0
votes
0 answers

I cant seem to figure out whats wrong with this piece of code

from pynput.keyboard import Key, Listener import logging log_dir = "C:/Users/Name/Desktop/logs/" logging.basicConfig(filename=(log_dir + "key_log.txt"), level=logging.DEBUG, format='%(asctime)s: %(messages)s') def on_press(key): …
Newbie
  • 1
0
votes
2 answers

How do I get text from tables using PyQuery?

I should start by saying I've not used pyquery much, so this question is probably easy, but I've tried a bunch of stuff and am stuck. I'm using PyQuery to get info from a table. Here is the beginning of my table:
Doubledown
  • 319
  • 1
  • 3
  • 13
0
votes
1 answer

python pyquery import not working on Mac OS Sierra

I'm trying to import pyquery as I did hundreds on time before, and it's not working. It looks like related to the Mac OS Sierra. (module installed with pip and up-to-date) from pyquery import PyQuery as pq And got an error on the…
Alex Pereira
  • 738
  • 1
  • 8
  • 16
0
votes
1 answer

Function to get a match for attributes in a list

I am trying to create a function to reduce what will be a lot of repeated code assigning to variables. Currently if I do this it works from pyquery import PyQuery as pq import pandas as pd d = pq(filename='20160319RHIL0_edit.xml') # from…
sayth
  • 6,154
  • 10
  • 47
  • 93
0
votes
1 answer

PyQuery - attr match only returns first match not all matches

When using pyquery I am not receiving every match for a selector just the first. Given this sample
sayth
  • 6,154
  • 10
  • 47
  • 93
0
votes
1 answer

pdfquery/PyQuery: example code shows no AttributeError but mine does...why?

I'm following the example code found here. The author has some documentation where he list some steps that used to write the program. When I run the whole program together it runs perfectly but when I follow the steps he's put I get an…
otteheng
  • 551
  • 6
  • 24
0
votes
1 answer

Different Output From Same PyQuery Object

I am using scrapy in order to crawl a web site. with open('test.html', 'wb') as f: f.write(response.body) With this block I am writing body to a file. When I open the file I can see many "a" tag. When I print the same thing with print. It…