Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I'm looking for a library in Ruby or Python that would take some HTML and CSS as the input and return data that contains the positions and sizes of the elements. If it helps, I don't need the info for all the elements but just the major divs of the page.
Scriptor, I think what you likely are looking for might be something in JavaScript more then Ruby or Python. I mean - the positions and sizes are essentially going to be determined by the rendering engine (the browser). You might consider using something like jQuery to loop through all of your desired objects - outputting the name of the object (like the DIV's ID) and the height and width of that item. So, for what it's worth I'd look at jQuery if I was in your position and the height() and width() methods. You never know - there may already be a jQuery plugin.
Both Ruby and Python have a Regex library. Why not search for things like /width=\"(\d+)px\"/ and /height:(\d+)px/. Use $1 to find the value in the group. I'm not a regex expert and I'm doing this from memory, so refer to any of the tutorials on the net for the correct syntax and variable usage, but that's where to start. Good luck,
bsperlinus
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I stumbled upon the wikidump python library, which I think suits me just fine.
I could get by by looking at the source code, but I'm new at python and I don't want to write BS code as the project I need it for is kind of important to me.
I got the 'wiki-SPECIFICDATE-pages-articles.xml.bz2' file and I would need to use that as my source for single article fetching. Can anyone give me some pointers as to properly achieve this or, even better, point at some documentation? I couldn't find any!
(p.s. if you got any better and properly doc'd lib, please tell me)
Not sure if I understand the question, but if you have the Wikipedia dump and you need to parse the wikicode, I would suggest mwparserfromhell lib.
Another powerful framework is Pywikibot, that is the historic framework for bot users on Wikipedia (thus, it has many scripts dedicated to writing pages, instead of reading and parsing articles). It has a lot of documentation (though, sometimes obsolete) and it uses MediaWiki API.
You can use them both, of course: PWB for fetching articles and mwparserfromhell for parsing.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Real-time api browser websites like ruby-docs.com and jqapi.com are very useful, it there any similar website for Python?
Updated:
By real-time I means instant search. docs.python.org is well-wriiten but a little hard for searching (comparing with ruby-docs.com and jqapi.co).
Not clear what you mean by real-time API in this respect, a Python API?.
The documentatation at http://docs.python.org is very useful and complete, supports multiple version of the Python language (starting with 2.6) and has search.
The search there is not as interactive e.g. the one on ruby-docs.com.
I use docs.python.org quite often and personally do not miss that interactivity, as my IDE for Python has a better interactive information than a website can provide.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Is there any "test-data" generation framework out there, specially for Python?
To make it clear, instead of writing scripts from scratch that fill my database with random users and other entities I want to know if there are any tools/frameworks out there to make it easier,
To make it even more clear, I am not looking for test frameworks, I want to generate test data to "put some load" my application.
http://code.google.com/p/fake-data-generator/
Looks like what you want. I tend to just use ranges with appropriate upper and lower limits and liberal use of lists.
If you need your test data to match the distribution of your population then you'll need to do more work though.
If you don't want to write any code, try Mockaroo. It's a free web app that allows you to generate random test data tables in lots of different formats such as XML, JSON, Excel, CSV. You are allowed to generate up to 1000 rows for free.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I am using python and the gdata library to parse the info of a youtube video.
My code is this:
yt_service = gdata.youtube.service.YouTubeService()
entry = yt_service.GetYouTubeVideoEntry(video_id='someid')
but in the entry.rating or entry.statistics there is no likes/dislikes
Where can I get that info from?
Once I use Python 3 and the gdata library doesn't have support for it I couldn't reproduce the results.
But as far as I know, the entry.rating returns a xml code with the whole statistic content of the video.
For a more specific result you should try entry.rating.average or entry.rating.num_raters
Looking at the source of the gdata library, it doesn't seem that it supports YouTube's like/dislike Gdata <yt:rating> element, only the generic <gd:rating> element.
If you are able to somehow access the underlying XML element through the library (I haven't used it myself), you should be able to get your hands at the YouTube rating element (qualified name should be {http://gdata.youtube.com/schemas/2007}rating, if that helps :) ).
Even better, if you are able to patch the library to actually natively support that element, all the better. I'm sure the authors would appreciate a patch. :)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I'm just starting with mwclient. I'm going to create bots to query our MediaWiki database and make small revisions.
But I cannot find anywhere a simple list of python commands like how to get ages of pages, contents of categories, contents of pages, etc.
Does anyone know a good starters resource?
The official docs at https://github.com/mwclient/mwclient/wiki have some introductory tutorials. I'm in charge for documentation for mwclient but haven't had enough time to really expand them - could use help from anyone who is willing.
One of my colleagues just sent me a link to the MediaWiki API wiki page.
I currently use python+urllib for API queries, and mwclient whenever I need to edit/create a page.
An useful place to get started with mwclient (read/edit/create a page):
http://brianna.modernthings.org/article/134/write-api-enabled-on-wikimedia-sites
The Bot Manual also has tons of good info and links, e.g. creating a bot.