Code Monkey home page Code Monkey logo

dcrrspndnt's Introduction

abandon

This project won't be maintained anymore. I've rewritten most of it here: https://github.com/xiffy/thcrrspndnt

dcrrspndnt

De Correspondentbot, zoekt op twitter links naar artikelen op De Correspondent (http://decorrespondent.nl/), indien een nieuw, gedeeld artikel wordt gevonden stuurt de bot een request voor dat artikel op de correspondent. Vervolgens leest de bot de open-graph informatie en slaat die bij het gevonden artikel op.

preview: http://molecule.nl/decorrespondent/

Installatie:

  • checkout de repo
  • kopieer settings.local.php.sample naar settings.local.php
  • optioneel kopieer ga.inc.php.sample naar ga.inc.php
  • wijzig de waardes in beide bestanden
  • maak de mysql database aan
  • draai create-db.sql om de tabellen aan te maken
  • voeg bot.php toe aan je crontab (eens per 10 minuten is meer dan genoeg) bijv:

(crontab entry)

*/10 * * * * cd /var/www/[xxx]/[xxx]/decorrespondent; php bot.php 1>>/tmp/correspondent.out 2>&1

In de data directorie staat een bestand some-data.sql, je kunt deze importeren in je database zodat je alvast een aantal artikel links en meta data hebt verzameld. Hiermee kan je je website bekijken zonder dat je de bot voor de eerste keer hebt opgestart. De data gaat over de artikelen die voor 9 oktober zijn verschenen. Als ik een verse datadump wegschrijf zal de datum in deze README dat aangeven.

open index.php in de Browser en begin te lezen.

Dit project maakt gebruik van simple_html_dom.php en oAuth

============================ Dit projectje is een proeve van bekwaamheid, vind je de artikelen van de Correspondent leuk, overweeg dan een abonnement http://decorrespondent.nl/

dcrrspndnt logo

dcrrspndnt's People

Contributors

quarkness avatar wietseneven avatar xiffy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dcrrspndnt's Issues

bot.php (PHP 7)

On line 138 in bot.php, php7 expects the connection parameter $db as an argument for mysqli_insert_id()

so
$artikel_id = mysqli_insert_id();
should be:
$artikel_id = mysqli_insert_id($db);

Search

why is the search function not working on the website ?

problems in php7

On lines 15-22 and lines 35-42 in menu.php, mysql/mariadb with PHP7 expects 2 more arguments for GROUP BY.

so, for lines 15-22

$r = mysqli_query($db,'select count(artikelen.id) as aantal_art, meta.*
from meta
join meta_artikel on meta.id = meta_id
left join artikelen on artikelen.id = art_id
where meta.type = "article:author"
group by meta.id
order by count(artikelen.id) desc, waarde
limit 0,25');

should be

$r = mysqli_query($db,'select count(artikelen.id) as aantal_art, meta.*
from meta
join meta_artikel on meta.id = meta_id
left join artikelen on artikelen.id = art_id
where meta.type = "article:author"
group by meta.id, meta.waarde, meta.type
order by count(artikelen.id) desc, waarde
limit 0,25');

and for lines 35-42

$r = mysqli_query($db,'select count(artikelen.id) as aantal_art, meta.*
from meta
join meta_artikel on meta.id = meta_id
left join artikelen on artikelen.id = art_id
where meta.type = "article:section"
group by meta.id
order by count(artikelen.id) desc, waarde
limit 0,25');

should be

$r = mysqli_query($db,'select count(artikelen.id) as aantal_art, meta.*
from meta
join meta_artikel on meta.id = meta_id
left join artikelen on artikelen.id = art_id
where meta.type = "article:section"
group by meta.id, meta.waarde, meta.type
order by count(artikelen.id) desc, waarde
limit 0,25');

PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in index.php on line 54

Mysql/Mariadb throws this error for each field in the artikelen table:

#1055 - 'dcrrspndnt.artikelen.#fieldname#' isn't in GROUP BY

so change line 54

$res = mysqli_query($db,'select artikelen.* from artikelen group by artikelen.id '.$order_by.' limit '.$start.','.ITEMS_PER_PAGE);

to this to get the articles to actually display

$res = mysqli_query($db,'select artikelen.* from artikelen group by artikelen.id, artikelen.clean_url, artikelen.t_co, artikelen.share_url, artikelen.created_at, artikelen.og  '.$order_by.' limit '.$start.','.ITEMS_PER_PAGE);

userscript

would it be possible to turn this source code into a greasemonkey userscript, so it automatically replaces the links on the official correspondent.nl website by the links posted on twitter.

this would be ideal, as you can browse the normal website, whilst being able to read all the articles.

RSS broken

RSS feed is broken since a few days:

line 188, column 163: XML parsing error: :188:163: not well-formed (invalid token)

Can you fix this? Thanks!

RSS out of sync

Het valt me op dat de RSS feed regelmatig en misschien zelfs permanent achterloopt op de website. Kan het dat de crontab issues heeft?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.