1
0
Fork 0
Browse Source

twitter lib, description

master
Alexander Yakovlev 4 years ago
parent
commit
6a6803f7e8
  1. 3
      composer.json
  2. 59
      composer.lock
  3. 21
      run.php

3
composer.json

@ -6,7 +6,8 @@
"longman/telegram-bot": "dev-master",
"mremi/url-shortener": "dev-master",
"revolution/laravel-mastodon-api": "dev-master",
"symfony/yaml": "^4.2@dev"
"symfony/yaml": "^4.2@dev",
"abraham/twitteroauth": "dev-master"
},
"require-dev": {
},

59
composer.lock generated

@ -4,8 +4,62 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "6903e9f20556c5d8505d2e29be759a61",
"content-hash": "6b935222c12b7c92375646b585f4c05a",
"packages": [
{
"name": "abraham/twitteroauth",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/abraham/twitteroauth.git",
"reference": "28697071d270f9336ab590c1716cc0237ffeb5ee"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/abraham/twitteroauth/zipball/28697071d270f9336ab590c1716cc0237ffeb5ee",
"reference": "28697071d270f9336ab590c1716cc0237ffeb5ee",
"shasum": ""
},
"require": {
"ext-curl": "*",
"php": "^5.6 || ^7.0 || ^7.1 || ^7.2"
},
"require-dev": {
"phpmd/phpmd": "~2.6",
"phpunit/phpunit": "~5.7",
"squizlabs/php_codesniffer": "~3.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Abraham\\TwitterOAuth\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Abraham Williams",
"email": "abraham@abrah.am",
"homepage": "https://abrah.am",
"role": "Developer"
}
],
"description": "The most popular PHP library for use with the Twitter OAuth REST API.",
"homepage": "https://twitteroauth.com",
"keywords": [
"Twitter API",
"Twitter oAuth",
"api",
"oauth",
"rest",
"social",
"twitter"
],
"time": "2018-07-04T01:28:41+00:00"
},
{
"name": "aura/autoload",
"version": "2.x-dev",
@ -1368,7 +1422,8 @@
"longman/telegram-bot": 20,
"mremi/url-shortener": 20,
"revolution/laravel-mastodon-api": 20,
"symfony/yaml": 20
"symfony/yaml": 20,
"abraham/twitteroauth": 20
},
"prefer-stable": false,
"prefer-lowest": false,

21
run.php

@ -27,8 +27,8 @@ use Mremi\UrlShortener\Provider\Bitly\GenericAccessTokenAuthenticator;
$config = Yaml::parse(file_get_contents('config.yml'));
var_dump($config['games']);
die();
$games = $config['games'];
krsort($games);
$pandoc = new \Pandoc\Pandoc();
$bitlyProvider = new BitlyProvider(
new GenericAccessTokenAuthenticator($config['BITLY_TOKEN'])
@ -46,8 +46,8 @@ if ($config['MASTODON'] === true) {
$mastodon = new MastodonClient($guzzle);
}
foreach ($source->games as $game) {
$description = $game->text();
foreach ($games as $place => $game) {
$description = $place.' место: '.$game;
if ($config['DRY_RUN']) {
echo $description."\n";
continue;
@ -68,19 +68,8 @@ foreach ($source->games as $game) {
}
if ($config['MASTODON'] === true) {
$mastodon->domain($config['MASTODON_SERVER'])->token($config['MASTODON_ACCESS_TOKEN']);
/*
if ($image) {
download('https://ifhub.club'.$image, './'.basename($image));
$attachment = $mastodon->post('/media', [
'file' => file_get_contents('./'.basename($image))
]);
var_dump($attachment);
unlink('./'.basename($image));
$mdescription .= $attachment->url;
}
*/
$mastodon->createStatus($description, [
'language' => 'en'
'language' => 'ru'
]);
if (!$config['DRY_RUN']) {
file_put_contents('.lastrun', time());

Loading…
Cancel
Save