mirror of
https://gitlab.com/octospacc/BeeWarehouse.git
synced 2025-06-05 21:59:35 +02:00
[JS Engine] Fix function hack; [Examples] Add FbLikebox;
This commit is contained in:
@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
const BeeWarehouse = require('../BeeWarehouse.js');
|
||||
const request = require('sync-request');
|
||||
const dom = require('@xmldom/xmldom').DOMParser;
|
||||
const xpath = require('xpath');
|
||||
|
||||
let ExampleCom = BeeWarehouse.LoadScrapersFile('./ExampleCom.xml').ExampleCom;
|
||||
let Info = eval(ExampleCom.Functions.GetInfo);
|
||||
console.log(Info);
|
6
Examples/ExampleCom/ExampleCom.js
Normal file
6
Examples/ExampleCom/ExampleCom.js
Normal file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
const BeeWarehouse = require('../../BeeWarehouse.js');
|
||||
|
||||
let ExampleCom = BeeWarehouse.LoadBeesFile('./ExampleCom.xml').ExampleCom;
|
||||
let Info = ExampleCom.Functions.GetInfo();
|
||||
console.log(Info);
|
@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scrapers>
|
||||
<scraper name="ExampleCom" apiurl="https://example.com">
|
||||
<bees>
|
||||
<bee name="ExampleCom" apiurl="https://example.com">
|
||||
<function name="GetInfo">
|
||||
<context method="GET" path="/" format="HTML">
|
||||
<request method="GET" path="/" format="HTML">
|
||||
<value name="Title" source="body" path="/html/body//h1[1]" key="text"/>
|
||||
<value name="Description" source="body" path="/html/body//p[1]" key="text"/>
|
||||
</context>
|
||||
</request>
|
||||
</function>
|
||||
</scraper>
|
||||
</scrapers>
|
||||
</bee>
|
||||
</bees>
|
11
Examples/FbLikebox/FbLikebox.js
Normal file
11
Examples/FbLikebox/FbLikebox.js
Normal file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env node
|
||||
const BeeWarehouse = require('../../BeeWarehouse.js');
|
||||
|
||||
let Arguments = { "Source": "profile.php?id=100043901540898" };
|
||||
let FbLikebox = BeeWarehouse.LoadBeesFile('./FbLikebox.xml').FbLikebox;
|
||||
|
||||
let Profile = ExampleCom.Functions.GetProfileInfo(Arguments);
|
||||
console.log(Profile);
|
||||
|
||||
let Posts = ExampleCom.Functions.GetLatestPosts(Arguments);
|
||||
console.log(Posts);
|
24
Examples/FbLikebox/FbLikebox.xml
Normal file
24
Examples/FbLikebox/FbLikebox.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<bees>
|
||||
<bee name="FbLikebox" apiurl="https://www.facebook.com">
|
||||
<set name="LikeboxUrl" value="/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2F{Source}&stream=true&_fb_noscript=1" arguments="Source">
|
||||
|
||||
<function name="GetProfileInfo" arguments="Source">
|
||||
<request method="GET" path="{LikeboxUrl}" format="HTML">
|
||||
<!-- <value ...> -->
|
||||
</request>
|
||||
</function>
|
||||
|
||||
<function name="GetLatestPosts" arguments="Source">
|
||||
<request method="GET" path="{LikeboxUrl}" format="HTML">
|
||||
<items source="body" path="/html/body//div[@role='feed']/div/div/div[2]">
|
||||
<set name="PostAnchor" value="./div[1]/div[2]/div[1]/div[2]/div/div/div[2]/a">
|
||||
<value name="Message" source="body" path="./div[1]/div[2]/div[2]" key="text"/>
|
||||
<value name="Media" source="body" path="./div[1]/div[1]//a/*[@src]" key="src"/>
|
||||
<value name="Time" source="body" path="{PostAnchor}/abbr" key="data-utime"/>
|
||||
<value name="Url" source="body" path="{PostAnchor}" key="href"/>
|
||||
</items>
|
||||
</request>
|
||||
</function>
|
||||
</bee>
|
||||
</bees>
|
Reference in New Issue
Block a user