Browse Source

update

fix-broken-scrape
Jørgen Sverre Lien Sellæg 5 years ago
parent
commit
e7a3146d8e
  1. 1
      .gitignore
  2. 2636
      backup.json
  3. 1
      package.json
  4. 4
      src/facebook-request.js
  5. 8
      src/maldito-mapper.js
  6. 4658
      yarn.lock

1
.gitignore vendored

@ -3,3 +3,4 @@ node_modules
*.log
events
img
backup

2636
backup.json

File diff suppressed because it is too large Load Diff

1
package.json

@ -1,6 +1,7 @@
{
"license": "MIT",
"dependencies": {
"https-proxy-agent": "^5.0.0",
"minimist": "^1.2.5",
"node-fetch": "^2.6.1",
"ramda": "^0.27.0"

4
src/facebook-request.js

@ -1,8 +1,11 @@
const fetch = require('node-fetch');
const graphql_endpoint = 'https://www.facebook.com/api/graphql/';
const https_proxy_agent = require('https-proxy-agent');
const do_request = async (doc_id, variables) => {
const params = new URLSearchParams();
const agent = new https_proxy_agent('http://10.0.0.210:5566');
params.append('doc_id', doc_id);
params.append('variables', JSON.stringify(variables));
@ -12,6 +15,7 @@ const do_request = async (doc_id, variables) => {
},
body: params,
method: 'POST',
agent,
};
let res = null;

8
src/maldito-mapper.js

@ -1,7 +1,11 @@
const input = require('../output.json');
const input = require('../dansbart.json');
const { by_date, event_times_to_dates, map_event } = require('./logic');
const events = input.map(map_event).map(event_times_to_dates).sort(by_date);
const events = input
.map(map_event)
.map(event_times_to_dates)
.sort(by_date)
.map(({ date, ...event }) => ({ ...event, date }));
console.log(JSON.stringify(events));

4658
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save