// Register Custom Taxonomy
function year_taxonomy() {
$labels = array(
'name' => _x( 'Года', 'Taxonomy General Name', 'text_domain' ),
'singular_name' => _x( 'Год', 'Taxonomy Singular Name', 'text_domain' ),
'menu_name' => __( 'Года', 'text_domain' ),
'all_items' => __( 'Все года', 'text_domain' ),
'parent_item' => __( 'Parent Item', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'new_item_name' => __( 'Новое имя года', 'text_domain' ),
'add_new_item' => __( 'Добавить новый год', 'text_domain' ),
'edit_item' => __( 'Изменить год', 'text_domain' ),
'update_item' => __( 'Обновить год', 'text_domain' ),
'view_item' => __( 'Посмотреть год', 'text_domain' ),
'separate_items_with_commas' => __( 'Разделить годы запятой', 'text_domain' ),
'add_or_remove_items' => __( 'Добавить или удалить год', 'text_domain' ),
'choose_from_most_used' => __( 'Выбрать из популярных', 'text_domain' ),
'popular_items' => __( 'Популярные года', 'text_domain' ),
'search_items' => __( 'Поиск годов', 'text_domain' ),
'not_found' => __( 'Not Found', 'text_domain' ),
'no_terms' => __( 'No items', 'text_domain' ),
'items_list' => __( 'Список годов', 'text_domain' ),
'items_list_navigation' => __( 'Items list navigation', 'text_domain' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
);
register_taxonomy( 'year', array( 'movie' ), $args );
}
add_action( 'init', 'year_taxonomy', 5 );
var options = {
method: 'GET',
uri: 'https://www.kinopoisk.ru/index.php?first=no&what=&kp_query='+encodeURIComponent(filmName),
json: true
};
rp(options)
.then(function (htmlString) {
$ = cheerio.load(htmlString);
var poster = $('.most_wanted>.pic>a>img').attr('title');
var title = $('.most_wanted>.info>.name>a').html();
console.log(title );
var filmData = new Array({poster: poster, title: title});
resolve(filmData);
})
.catch(function (err) {
// Crawling failed...
});
return Promise.all(myRequests)
.then((arrayOfHtml) => arrayOfHtml.map(result => result.data))
.then((arrayOfHtml) => {
//Пытаемся получить картинку от ласт фм, если нету, выдаем пустую строку
if(arrayOfHtml[0].results.artistmatches.artist[0]['image'][2]['#text']){
last = arrayOfHtml[0].results.artistmatches.artist[0]['image'][2]['#text'];
}else {
last = false;
}
if(last) {
some();
}
})
.catch(function(e){
//Ловим ошибку
console.log(chalk.red("Ошибка " +e));
});
io.on('connection', function (socket) {
socket.on('songchanged', function(changed){
socket.broadcast.emit('changed', data);
})
})
result.forEach(function(item){
wp.song().search( item['artist']+' - '+item['song'] ).then(function( posts ) {
if(!posts[0]){
var myRequests = [];
myRequests.push(rp({uri: "http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist="+encodeURIComponent(item['artist'])+"&api_key=*****&format=json", json: true}));
myRequests.push(rp({uri: "https://www.googleapis.com/youtube/v3/search?part=snippet&order=viewCount&q="+encodeURIComponent(item['artist']+'+'+item['song'])+"&type=video&key=***", json: true}));
Promise.all(myRequests)
.then((arrayOfHtml) => {
console.log(arrayOfHtml[0]['artist']['image'][2]['#text']);
console.log(arrayOfHtml[1]['items'][0]['id'].videoId);
wp.posts().create({
title: item['artist']+' - '+item['song'],
content: 'Your post content',
status: 'publish'
}).then(function( response ) {
console.log( response.id );
})
})
.catch(/* handle error */);
}
});
})`
request.get("https://www.googleapis.com/youtube/v3/search?part=snippet&order=viewCount&q="+result[k]['song']+'+'+result[k]['song']+"&type=video&key=AIzaSyAvDAdEnqrStOJNnpnGy9BkrC_sG-gcHIU", function(err,res,body){
if(res.statusCode == 200 ) {
var c = JSON.parse(body);
console.log(c['items'][0]['id']['videoId']);
}
});
<form action="/about/#wpcf7-f104-o3" method="post" class="wpcf7-form" novalidate="novalidate">
<div class="inner">
<label>Email</label><span class="wpcf7-form-control-wrap email">
<input type="email" name="email" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" aria-required="true" aria-invalid="false" autocapitalize="off" autocorrect="off" autocomplete="off"></span><p></p>
</div>
<div class="inner">
<label>Phone#</label><br>
<input type="tel" name="phone" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-tel wpcf7-validates-as-required wpcf7-validates-as-tel phone-inpt" aria-required="true" aria-invalid="false" autocapitalize="off" autocorrect="off" autocomplete="off"></span><p></p>
</div>
<div class="inner sbm">
<input type="submit" class="sbmit-btn btns" value="Submit" autocapitalize="off" autocorrect="off" autocomplete="off">
</div>
height: 20px;
width: 100%;
float: left;
border: 1px solid #8a8a8a;
padding-left: 9px;
font-family: 'proxima_nova_rgregular';
font-size: 16px;
line-height: 16px;
color: #181818;