Get text from web page to string

Use This: public class ReadWebpageAsyncTask extends Activity { private TextView textView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); textView = (TextView) findViewById(R.id.TextView01); } private class DownloadWebPageTask extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String… urls) { String response = “”; for (String url : … Read more

How can I take a screenshot/image of a website using Python?

Here is a simple solution using webkit: http://webscraping.com/blog/Webpage-screenshots-with-webkit/ import sys import time from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * class Screenshot(QWebView): def __init__(self): self.app = QApplication(sys.argv) QWebView.__init__(self) self._loaded = False self.loadFinished.connect(self._loadFinished) def capture(self, url, output_file): self.load(QUrl(url)) self.wait_load() # set to webpage size frame = self.page().mainFrame() self.page().setViewportSize(frame.contentsSize()) # render image image … Read more

How to use greasemonkey to selectively remove content from a website

For questions like this, post a link to the target page. Or, if that is really not possible, save the page to pastebin.com and link to that. Anyway, the general answer to your question is not too hard with the jQuery contains() selector. Something like this will work: // ==UserScript== // @name _Remove annoying divs … Read more

JavaScript at bottom/top of web page?

It’ll allow the web page to load visibly before executing JavaScript, which makes sense for things like Google Analytics, which don’t need to happen before the page loads. You may also want to look into things like jQuery, prototype, etc and attach to the “ready” handler, which executes JavaScript code after the DOM has been … Read more

How to change page in jQuery mobile (1.4 beta)?

As of jQuery Mobile 1.4, $.mobile.changePage() is deprecated and replaced with: $(“:mobile-pagecontainer”).pagecontainer(“change”, “target”, { options }); Shortened… $.mobile.pageContainer.pagecontainer(“change”, “target”, { options }); Even shorter…(1) $(“body”).pagecontainer(“change”, “target”, { options }); Note: target is #page_id or URL. Demo (1) <body> is pageContainer by default, unless $.mobile.pageContainer is modified on mobileinit.

Convert webpage to image from ASP.NET

Ok, this was rather easy when I combined several different solutions: These solutions gave me a thread-safe way to use the WebBrowser from ASP.NET: http://www.beansoftware.com/ASP.NET-Tutorials/Get-Web-Site-Thumbnail-Image.aspx http://www.eggheadcafe.com/tutorials/aspnet/b7cce396-e2b3-42d7-9571-cdc4eb38f3c1/build-a-selfcaching-asp.aspx This solution gave me a way to convert BMP to JPG: Bmp to jpg/png in C# I simply adapted the code and put the following into a .cs: using … Read more