I am looking for some helpful gems in ruby for scraping purposes. Basically, I am looking to be able to scrape the main body from the page. That is, only the main body and its media (images). No sidebar or footer or navbar type of stuff.
I know scraping requires a lot of specificities like knowing the classes and ids and so on. So I am wondering if there is a tool that does something like this?
A good example would be the "Reader View Available" option in safari when on iOS. Where it just shows the raw content from the page. With required headers and paragraphs.
Use Nokogiri
And you can also use Css Selector Gadget to find your classes. This should be helpful to find proper header and body classes or id's.
Reader View doesn't save bandwidth
Related
I want to create a universal header (and footer) using HTML/CSS/Javascript so that if I update it to one page, it automatically updates on the rest. I also want to be able to choose which link is showing up with the active class on it. Also, I am using bootstrap. Here are some criteria I need to meet:
No PHP
No Server side (must work on github pages)
Thank you in advance,
Albert
You can use jQuery to .load a HTML file:
HTML
<div id="header"></div>
jQuery
$('#header').load('static.html');
Alternatively, you could use iframe to load your static header. See this answer for more information regarding the available techniques.
Maybe try Jekyll, this is a tool to generate static pages, also this is how the githup page handles your own personal page. You just follow the file structure and set the layout properties in your files, then you can use the universal layout (including header, footer etc.) in your page.
Here is a link to Jekyll.Jekyll
I want to share a specific content of my site by way of a link, and I would that when I share it on Facebook, Twitter, Google+, etc., a certain image, title and description will be shown.
It's so easy when I share my site URL because it's sufficient to modify the related meta tags, but it is not so trivial do it with a specific content you want share with dedicated image, title, description.
I thought, since these information shall be specified in meta tags why not to enclose my content into an iframe which contains a simple html page with all necessary meta tags?
This way when I try to share my link on a social network the content summary will be filled with my meta tags infos.
Have you a smarter solution?
Well, I believe that every social media have different ways to get this information, and some do not even need them (like twitter does not need a picture to a tweet).
And they are always changing how they do it, facebook is an example url parties is being deprecated and they are forcing us to use their api to share / like / whatever.
What you can do is to work with these differences on their own, or get js social plugins to handle it for you.
edit: here are some plugins http://community.paper.li/2012/10/15/top-8-social-media-plugins-for-your-blog-or-website/
As our users get more familiar with the wiki functionality, and like it, we see that pages are getting longer and more difficult to navigate.
We would like to be able to generate table of contents on a per-wiki-page basis to allow easier navigation, i.e. the users create content whose hierarchy is represented by h2/h3/h4 elements and then the TOC is automatically generated at the top of the wiki page with each entry in the TOC being a link to the corresponding h2/h3/h4 element in the page.
We do not have access to Sharepoint Designer so any funny stuff will have to involve css/javascript inserted using a Content Editor Web Part.
Best regards,
Colm O'Gairbhith
In case this may be useful to anyone else, I ended up using the jquery tableofcontents plugin.
The tutorial Automatically Generate Table of Contents with jQuery explains how to use this.
I really like the type of page shown here:
http://jquerymobile.com/demos/1.0b1/#/demos/1.0b1/docs/pages/docs-pages.html
But I cannot find in the source anything that says where the "Anatomy" or anything on how to get the navigation bar and content area.
How do I make/get the content area and navigation area like the one shown in the demo?
I'm also looking for a solution to this as it's a very useful layout for navigating records. But viewing the source is a headache since the structure isn't simlar enough to the API and there's a couple dozen css classes interacting with each other.
But i did discover a split-view plugin which might work:
http://asyraf9.github.com/jquery-mobile/
just as in the last answer - http://asyraf9.github.com/jquery-mobile/
There is a link to: https://github.com/asyraf9/jquery-mobile/
There is a repository zip file download link in the top left.
But when you get there, and you look at the file viewer and so on it seems kinda confusing. When you look at the files close enough they are the same resource doc files from the JQ Mobile site.
***The difference is in the file structure: demos\experiments\ you will see the a "splitview" directory. You can use the contents of that dir for reference.
A client wants a merch shop on their site, and has set one up. I could iFrame in the whole page to the merch page, but frankly the merch site is an eyesore, and their site has a very particular feel to it. So I'm considering using an AJAX GET to grab the whole page, then javascript to display only the div with the merchandise in it. However, there are a lot of javascript includes (etc) on the merch site that I'd need to make sure are still present for the div to work correctly.
Any feeling on if this would work or not? Would the displayed div take its stylesheet and scripts from the AJAX'd page? Can I put the div in an iframe instead?
Opinions?
It sounds like an ugly solution. Isn't it better to do this serverside instead, for example let a PHP script read in the page and to whatever magic it takes to display it?
Using AJAX to load entire pages is ugly for a couple of reasons, including:
It breaks the URLs (can be worked around but requires extra work)
It's hard for search engines to crawl your site
It breaks some GUI elements in the browser, such as loading visualisations
looks like you can use jquery load function http://docs.jquery.com/Ajax/load