Hi there,

Great module. I'm using the wikipedia module and want to know

1. If there's any way I can make it s that the entire article is pasted into the body field, not just a snippet; and

2. If tables and more complicated things could be included in the body.

Best wishes,

heebie.

Comments

brevity’s picture

You could retrieve the rendered Wikipedia article instead of the the wiki raw text, e.g. by replacing the relevant bit in the URL specified in the .inc file:

$rawurl.= "&action=raw&section=0"; // -->

$rawurl.= "&printable=yes";

... and put the content into $result['body'] ...

If you need both the parsed infobox and the full html retrieve both for a start ... u could strip the infobox from the latter though ...

Cheers

Example pages (:
http://en.wikipedia.org/w/index.php?title=Scoop_(2006_film)&action=raw&section=0
http://en.wikipedia.org/w/index.php?title=Scoop_(2006_film)&printable=yes

B747’s picture

Hi,

Thanks for your reply. I replaced $rawurl.= "&action=raw&section=0"; with $rawurl.= "&printable=yes"; but it broke the retrieving. You said to put the content into $result['body'] , but surely it's already getting the data from that url and putting it into the body anyway?

BTW the exact error I get is

warning: file_get_contents(http://en.wikipedia.org/w/index.php?title=Bristol&printable=yes) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in /home/heebie/public_html/blog/sites/all/modules/createfromweb/operator_wikipedia.inc on line 72.

Also, would I not have to strip out all the meta data and all those crusty scripts it loads? Those preg_replace commands sure look complicated to me....

Best wishes,

heebie.

synistics’s picture

I have followed these instructions step by step and failed as well.

I did not the above error message, just a blank output. The page showed the Title and body, both blank

I tried to modify the action statement with these actions:

$rawurl.= "&action=raw";

or

$rawurl.= "&action&printable=yes";

which returned blanks.

I followed the change to the trim[body] line with the instructed

$result['body']

this just returns an error code for the next line of code (Line 98).

I tried this function, but I know all it does is sidestep the "trim" functions and drops the limited raw into the page.

$result['body'] = $body;

I need to pull more than the first block of the wiki page in, maybe not all, but more the section 0. I know changing the value will give the section 1, and so on, but I cannot get consecutive sections say 0,1,2 because sometimes the page is too long and in some instances the information I need is in section 0, 2 and 3.

Even if I could get the whole page in, I can cut it down in the edit window before publishing.

TIA for any help

Synistics