oliviera9 on add-polygon-oar
oliviera9 on master
feat: add Polygon mainnet OAR Merge pull request #111 from pr… (compare)
oliviera9 on add-polygon-oar
feat: add Polygon mainnet OAR (compare)
oliviera9 on add-bsc-oar
oliviera9 on master
feat: add BSC mainnet OAR Merge pull request #107 from ol… (compare)
oliviera9 on add-polygon-oar
feat: add Polygon mainnet OAR (compare)
oliviera9 on add-bsc-oar
feat: add BSC mainnet OAR (compare)
oliviera9 on add-polygon-oar
feat: add Polygon mainnet OAR (compare)
oliviera9 on add-polygon-oar
feat: add Polygon mainnet OAR (compare)
@oraclize-support just tested things on Kovan and it looks like the API is partially working.
The provable_query function which doesn't take a timestamp as parameter: provable_query("URL", "https://foobar.com") is working fine, the callback gets executed without issues instantly.
However, trying to schedule the query into the future by taking a look at the current epoch (https://www.epochconverter.com/) and adding a few minutes to it, that's when the callback fails to execute. I can replicate this on every single testnet, and it kind of discourages me to try things in the mainnet with real money at the moment.
Contract code: https://pastebin.com/DjRhrkZG
Etherscan: https://kovan.etherscan.io/address/0x1d5E0B25A60B6dE63e44457290c8ef50a2189f3c
The 2 successful callbacks were executed by calling provable_query without any timestamp. The unsuccessful call due to lack of funds was also logged correctly, but no logs for the scheduled callback can be seen.
Do you have any idea as to why only scheduled calls to Provable could be failing?
pragma solidity >= 0.5.0 < 0.6.0;
import "github.com/provable-things/ethereum-api/provableAPI_0.5.sol";
contract YoutubeViews is usingProvable {
string public viewsCount;
event LogYoutubeViewCount(string views);
event LogNewProvableQuery(string description);
function __callback(
bytes32 _myid,
string memory _result
)
public
{
require(msg.sender == provable_cbAddress());
viewsCount = _result;
emit LogYoutubeViewCount(viewsCount);
// Do something with viewsCount, like tipping the author if viewsCount > X?
}
function update()
public
payable
{
emit LogNewProvableQuery("Provable query was sent, standing by for the answer...");
provable_query("URL", 'html(https://www.youtube.com/watch?v=9bZkp7q19f0).xpath(//*[contains(@class, "watch-view-count")]/text())');
}
constructor()
public
{
update()
}
}
@gwills:[matrix.org](http://matrix.org) probably remix doesn't support github sym link anymore. Try to replace the import string with the following one:
import "github.com/provable-things/ethereum-api/provableAPI_0.5.sol";
This should compile fine
Hi @NazarovALAL, unfortunately YouTube doesn't provide the same HTML code you see when accessing the page through your browser, hence why the xpath clause fails to get the views. This happened to other users before and the code there is a bit out of date for that purpose but still valid as an example if you want to access an HTML through .xpath().
You can do a test by looking for an website where you get the same HTML by other means other than the browser (using curl or wget for example)