Tagged Questions
0
votes
1answer
25 views
Python regex issues
Im trying to grab proxies from a site using python by scanning through the page with urlib and finding proxies using regex.
A proxy on the page looks something like this:
<a ...
0
votes
2answers
28 views
How do I store html data in a mysql database?
I have a sql written in python like .
cur.execute("INSERT INTO products_details(
title,
description,
price,
currency,
sku,
brand,
colors,
sizes,
actual_url,
meta_title,
meta_keywords,
...
0
votes
1answer
18 views
Javascript or Python library to do bidirectional HTML to Markdown conversion [on hold]
I am looking for Javascript or Python library that is able to do bidirectional HTML to Markdown conversion. I found libraries in both languages to go either way, but none that goes both ways. In ...
1
vote
1answer
20 views
Parsing through the HTML and scripts on a webpage using python?
I'm currently using Beautiful Soup to parse through the HTML of a webpage. However, I would also like to recursively parse through any .js files on the webpage as well. My goal is to look for certain ...
0
votes
1answer
22 views
How to use beautifulsoup when HTML element doesn't have a class name?
I am using the following code (slightly modified from Nathan Yau's "Visualize This" early example) to scrape weather data from WUnderGround's site. As you can see, python is grabbing the numeric data ...
0
votes
2answers
25 views
scraper only returning results for first 2 inputs
I am trying to build a scrape tool that imports a csv file, then attaches each row from the csv to a url, then scrapes that url for a specific field. So far the tool adds all the urls and scrapes for ...
-3
votes
0answers
23 views
How do you Incorporate SSH into Python? [on hold]
I want to plug a bunch of machines I need into SSH and then automatically run a script through my SSH session. There's a lot to this and I'm just looking for a little help or to be pointed in the ...
0
votes
1answer
16 views
Get text next to selected element in lxml / Python
I have the following HTML markup and I'd like to get the English description as plain text out of this snippet - without the "English, and without any tags":
from lxml import etree
html = '''
...
0
votes
0answers
27 views
MongoDB with python to HTML
We're trying to do the following:
The user selects a certain category on a website. The website requests all items in the mongodb database fitting that category out of the database and loads it into ...
0
votes
1answer
15 views
Execution of python script on webserver via link
I finally managed to get my web-server up and running python.
I am now able to enter the direct url pointing to the python script and it is being executed.
I wrote a script which generated a html ...
1
vote
1answer
14 views
lxml — how to change img src to absolute link
Using lxml, how do you globally replace all src attributes with an absolute link?
0
votes
1answer
21 views
Refreshing images on a page without refreshing the whole page with Django
I'm making an application that receives images.
I'm making it in a pretty hacky way, where this is the HTML:
<body onload="javascript:setTimeout('location.reload(true);', 1000);" >
<div ...
0
votes
0answers
21 views
i cant add values using pythonpsycopg connecting to the database postgresql
i cant add values using python psycopg connecting to the database postgresql. But when i input some values directing to the Postgresql i can now see in the python what i add manually from postgresql.
...
1
vote
2answers
27 views
KeyError in Python
G'day!
So this is my code:
print """\
<form method="post">
Please enter Viewer Type:<br />
<table>
"""
#Viewer Type
print "<tr><td>Viewer Type<select ...
0
votes
0answers
12 views
Adding URLs to pandas DataFrame in Django
I have a pandas DataFrame containing counts that I render in a Django template with the to_html() method. I would like to add urls to the indexes and numeric data. The intention is to create GET ...
-2
votes
0answers
19 views
Python : How can I get html element from open browser [on hold]
I worte some code in AutoIt using the FF.au3 ,
There is any way to get the html element form the currect open browser ?
For example :
My autoit script connect to firefox with mozrepl and run over ...
-2
votes
1answer
17 views
How automatically change a website from a changing file? [on hold]
I have an HTML file on my computer, and the file is constantly changing. Is there a way to make my website automatically change to the HTML file?
For example, I have a file index.html and a website ...
1
vote
1answer
26 views
How can I get the text with xPath between </ul> and <p>?
I have the HTML code and I want to parse string that starts with "Pour all ingredients" with xPath. I have already done the trick with span and li objects. But this text is not belonged to anything. ...
0
votes
1answer
17 views
Html string from a variable not rendered using mako in python
When I try to render a string variable in mako template like:
${ variable_name }
As, the variable contains html content, the content is not rendered properly. Rather than displaying HTML, the output ...
0
votes
0answers
28 views
How to keep track of user once he/she logs in (Flask)
I created two simple views on my website. In the first one the user logs in and I set the session to 'logged_in':
@app.route('/', methods=['GET', 'POST'])
def login():
error = None
if ...
0
votes
1answer
23 views
Extracting the value of a specific HTML element using XPath in Python
I have tried this
url = 'http://test.ir/'
content = s.get(url).content
tree = html.fromstring(content)
print [e.text_content() for e in tree.xpath('//div[@class="grouptext"]/text()[not(self:div)]')]
...
1
vote
3answers
25 views
Django Dropdown with Foreign key in Bootstrap Form
I am developing my first Django Website and i want to use a Foreign Key drop down in a Bootstrap Form. I am able to add the Foreign Key by manually typing in the foreign key number (e.g. "1") and the ...
-1
votes
0answers
13 views
convert string to ascii code to represent in html page [duplicate]
currently i am trying to retrieve the string Qualcomm® WCN3660 from DB and represent in html. But i am not able to convert it to ascii code it prints Qualcomm� WCN3660 in html.
Getting the following ...
0
votes
1answer
29 views
some issues with web scraping imd website
So I was scraping this Indian weather website
http://202.54.31.7/citywx/localwx.php
So from the left pane you can see all the Indian states, and if you hover over them you can select the ...
-2
votes
0answers
19 views
find information within specific html tags
I want to extract some information from a web page, I use requests and BeautifulSoup.
I used my browser to inspect the elements of the page and found the information that I wanted within some ...
0
votes
0answers
24 views
How can I parse an excel sheet that is in html through python?
I have an excel sheet that is actually an html table (must have been saved as 'save as webpage' on excel). When I open the .xls in a texteditor, it starts with:
<html ...
1
vote
1answer
13 views
Script NBConvert to Output to Multiple HTML Files
I have a Python/Pandas script that will generate some reports I would like. Currently, NBConvert will always save the file as the title of my iPython notebook. Ideally, were my report on the subject ...
0
votes
3answers
44 views
Extracting links with regex from source code; Python
I have a dataset of links to newspaper articles that I want to do some research on. However, the links in the dataset end with .ece extension (which is a problem for me because of some api ...
0
votes
2answers
28 views
How to extract hidden tags created by javascript from source page by python
I have THIST page that has some javascript in it. You can see them by clicking on show details.
So how can I extract these data from that url source?
Using re? What I tried in re is:
import ...
0
votes
0answers
6 views
HTMLTestRunner parallel execution
I'm using HTMLTestRunner for my unit tests in order to generate a nice output report. Here's a snippet from my code:
import unittest
import HTMLTestRunner
suite = unittest.TestSuite()
...
report = ...
-2
votes
3answers
78 views
Python regular expression select “Nissan” word except between <a>…</a> or <span>…</span> tag
View on Live regex101
My regular expression pattern is
[Nn]issan(?=[^<>]*<)(?!(?:(?!</?(?:a|span)[ >/])(?:.|\n))*</(?:a|span)>)
I want to stop capture url inside nissan ...
0
votes
2answers
32 views
Using beautiful soup to pull text from multiple <tr>'s
The goal is to output a dictionary of course names and their grade from this:
<tr>
<td class="course"><a href="/courses/1292/grades/5610">Modern Europe & the World - ...
0
votes
1answer
11 views
Add an optional subexpression to a RE on python
How I can add a subexpression of a regular expression in python?
Indicating that some html code may or may not appear in the text.
It's because I'm making an API for filmaffinity and want to make a RE ...
1
vote
2answers
29 views
Extracting the value by xpath in python between tags
I want to extract parameter that I referred in the picture below...
What I have tried is:
url='http://site.ir'
content=requests.get(url).content
tree = html.fromstring(content)
print ...
0
votes
2answers
29 views
How to use BeautifulSoup to extract data outside of html tags
I am new to python and SO. Here is my question.
I'm trying to extract data from the following webpage NDBC - Station 46011. I've been watching a tutorial on how to use BeautifulSoup to gather data ...
-2
votes
0answers
31 views
Processing simple form data with python
I created this simple form and a python script to process the data.
I uploaded it to my host and when I submit the form, the page shows my python source code. Should my host support something ...
-1
votes
1answer
34 views
using a variable as an image source in html? (python)
Before I start please pardon my english, totally newbie in HTML and this is the very first django app I'm creating.
So let's say I want to view static images based on the input in the forms for ...
1
vote
4answers
40 views
How can I use Python to extract information from a HTML document?
I need python to extract some data from a HTML file.
The code I am using at the moment is bellow:
import urllib
recent = ...
0
votes
1answer
25 views
HTMLParser misunderstands entities in href. Is it a bug or not? Should I report it?
I don't want to know how to solve the problem, because I have solved it on my own. I'm just asking if it is really a bug and whether and how I should report it.
You can find the code and the output ...
0
votes
0answers
18 views
pre Python 3.4 HTML entity unescaping
NOTE: This let's you do 3.4 HTML5 entity conversion on pre-3.4 Python versions!
I'm writing a parser+renderer for the CommonMark spec of Markdown and I'm trying to figure out the best way to escape ...
0
votes
1answer
23 views
python's mechanize and forms: javascript string returned
I am trying to access http://forum.kriminala.net via Mechanize and parse my inbox messages.
From the html code, I can see that the login form is in the nested iframe of the main page:
<iframe ...
-3
votes
2answers
47 views
why can't i display data from a postgres table in html
hey so i'm storing a string like '<h1>test</h1><br><br><h1>yep</h1>' in a table then displaying the result on my webserver, the problem is that the string is ...
1
vote
1answer
45 views
Python - get first a tag parsing html
I am using python and beautiful soup to parse this web page. https://rpi.sodexomyway.com/dining-choices/res/sage.html In the "on the menu" section I want to get the url of the first link.
Here is the ...
0
votes
1answer
23 views
How to extract it from HTML with Python?
I am trying to extract that data:
<div class="address"><h3>Text1</h3><div class="adr">Text2</div></div>
I want to print text1 and text2.
I try this:
br = ...
1
vote
1answer
21 views
CGI serving HTML not rendering
I have CGI python program serving HTML as content (not URL). The flow is:
1. open http://jioworld.jioconnect.com/cgi-bin/loginpp.py
2. you get HTML form (since you have not yet login)
3. enter some ...
0
votes
1answer
51 views
Wrong html-tags
is there a simple way to correct wrongly interpreted html-tags?
For example: I have the following text in a html-file:
<div class=paragraph style=" padding:0.00pt 18.48pt 0.00pt 19.68pt; ...
0
votes
1answer
8 views
Using Jinja2 strings with spaces as HTML attributes
If I pass Jinja2 a string that contains a space, such as:
myStr = "my string" #a google.appengine.ext.db.StringProperty
And then render it, e.g.:
<div class={{ myStr }}>
The generated HTML ...
1
vote
1answer
43 views
How to store list of database items in HTML?
I'm working on a project using Django framework. I'm displaying to user table with data. Next to each row there is an "Edit" button. When user clicks this button, in one of cells of the row select box ...
-1
votes
2answers
29 views
Why does Beautiful Soup return this random string?
I am trying to parse a web page to get a brief overview from a stock. From seekingalpha, the HTML looks like this:
<div class="company_description_mini_text">
<span style='white-space: ...
2
votes
0answers
50 views
BeautifulSoup extract XPATH or CSS Path of node
I want to extract some data from HTML and then be able to highlight extracted elements on client side without modifying source html. And XPath or CSS Path looks great for this. Is that possible to ...