I've been trying to fetch videos from YouTube API, but it seems like whenever I try to fetch them, somehow the map function won't work. (TypeError: Cannot read property 'map' of undefined)
The code was successful in fetching array lists from here, but not from YouTube.
I suspect the problem occurred because the array that YouTube provided was inside an [items] object.
Here are my code:
PopularApp.js
import React, { Component, useState, useEffect } from 'react';
import PopularVid from "./components/PopularVid";
import axios from 'axios';
const PopularApp = () => {
const [video, setVideo] = useState([]);
const hotVids = video.items;
const [loading, setLoading] = useState(false);
const [currentPage, setCurrentPage] = useState(1);
const [vidsPerPage, setVidsPerPage] = useState(10);
useEffect(() => { //whenever this function runs, it will run this/fetch data from API, neverending loop
const fetchPosts = async () => {
setLoading();
const res = await axios.get('https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&chart=mostPopular&maxResults=12&key=myapikey');
setVideo(res.data);
setLoading(false);
}
fetchPosts();
}, []);
console.log(hotVids);
return(
<div>
<PopularVid videos={hotVids} loading={loading}/>
</div>
)
}
export default PopularApp;
PopularVid.js
import React from 'react';
const PopularVid = ({videos, loading}) => {
if(loading){
return <div>Loading...</div>
}
return <ul>
{videos.map(video=>(
<li key={video.id}>
{video.snippet.title}
</li>
))}
</ul>;
}
export default PopularVid;
And here is the sample of the YouTube json file that I am trying to parse:
{
"kind": "youtube#videoListResponse",
"etag": "_Y60U4EX77fYwquDNkByKBxEGC8",
"items": [
{
"kind": "youtube#video",
"etag": "V8SLDA5Sop7jpKOC9NnsckQoOwM",
"id": "lEIqjoO0-Bs",
"snippet": {
"publishedAt": "2020-04-29T19:06:00Z",
"channelId": "UCKrdjiuS66yXOdEZ_cOD_TA",
"title": "Video #1",
"description": "This is the description",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/lEIqjoO0-Bs/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/lEIqjoO0-Bs/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/lEIqjoO0-Bs/hqdefault.jpg",
"width": 480,
"height": 360
},
"standard": {
"url": "https://i.ytimg.com/vi/lEIqjoO0-Bs/sddefault.jpg",
"width": 640,
"height": 480
},
"maxres": {
"url": "https://i.ytimg.com/vi/lEIqjoO0-Bs/maxresdefault.jpg",
"width": 1280,
"height": 720
}
},
"channelTitle": "Channel",
"categoryId": "10",
"liveBroadcastContent": "none",
},
"statistics": {
"viewCount": "4633587",
"likeCount": "349875",
"dislikeCount": "6602",
"favoriteCount": "0",
"commentCount": "27237"
}
},
{
"kind": "youtube#video",
"etag": "2KGplnTU4KAR0gTjmL8nXnzlK34",
"id": "XRNjRcKZc1A",
"snippet": {
"publishedAt": "2020-04-29T16:00:30Z",
"channelId": "UC47kJWRBD-NREBvmBg5kWeA",
"title": "Video #2",
"description": "Description #2",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/XRNjRcKZc1A/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/XRNjRcKZc1A/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/XRNjRcKZc1A/hqdefault.jpg",
"width": 480,
"height": 360
},
"standard": {
"url": "https://i.ytimg.com/vi/XRNjRcKZc1A/sddefault.jpg",
"width": 640,
"height": 480
},
"maxres": {
"url": "https://i.ytimg.com/vi/XRNjRcKZc1A/maxresdefault.jpg",
"width": 1280,
"height": 720
}
},
"channelTitle": "King Von",
"categoryId": "10",
"liveBroadcastContent": "none",
"defaultAudioLanguage": "en"
},
"statistics": {
"viewCount": "901039",
"likeCount": "62449",
"dislikeCount": "1862",
"favoriteCount": "0",
"commentCount": "5184"
}
}
],
"nextPageToken": "CAIQAA",
"pageInfo": {
"totalResults": 200,
"resultsPerPage": 2
}
}
res.data is an object you can not use map for an object, you can use it for arrays. I believe what you need to map is res.data.items
Two things:
The initial value of hotVids is undefined. ([].items). After the data is fetched it should be OK.
loading is never true. Looks like you meant to set it to true inside useEffect. You also could have initialised it to true with useState.
To deal with data that isn’t loaded yet, you’d generally do one of two things: set a reasonable default (like your empty array), which can render successfully; or prevent rendering until loading is done (like your loading variable).
Related
so im using the youtube api to grab information about the live status of a channel. If you use this type of link normaly:https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=(CHANNELID)&eventType=live&type=video&key=(APIKEY)
you get no important information, but if the specified channel is live it gives alot of information like the status that it is indeed live. I am grabbing that information but it doesnt change, so i still get the return json like the channel isnt live but if i click the link i can clearly see all the information but it isnt grabbing it
client.on('message', async message => {
if(message.content=="!cat"){
let getData= async () =>{
let response= await fetch("https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCvaTdHTWBGv3MKj3KVqJVCw&eventType=live&type=video&key=(APIKey")
console.log(response)
let Data=await response.json()
console.log(Data)
return Data
}
let FinalData= await getData()
console.log(FinalData.liveBroadcastContent)
message.reply(FinalData.liveBroadcastContent)
}
});
this is what shows up in my fetch:
kind: 'youtube#searchListResponse',
etag: 'Byi7iAkYUIpWKxdVS-MPyYo1_sY',
regionCode: 'DE',
pageInfo: { totalResults: 1, resultsPerPage: 1 },
items: [
{
kind: 'youtube#searchResult',
etag: 'jTlF5DKseNmUsYji3o253M32ZhA',
id: [Object],
snippet: [Object]
}
]
}
this is what shows when i go onto the same link in my browser:
"kind": "youtube#searchListResponse",
"etag": "Byi7iAkYUIpWKxdVS-MPyYo1_sY",
"regionCode": "DE",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#searchResult",
"etag": "jTlF5DKseNmUsYji3o253M32ZhA",
"id": {
"kind": "youtube#video",
"videoId": "2DacDYB6jVs"
},
"snippet": {
"publishedAt": "2021-11-29T06:00:03Z",
"channelId": "UCvaTdHTWBGv3MKj3KVqJVCw",
"title": "【シャイニングパール】地上へ戻ってきました#3【#スバおか対決 /ホロライブ】",
"description": "_ 3つ目のバッチ目指してゴー!✨ スバルちゃん :https://www.youtube.com/channel/UCvzGlP9oQwU--Y0r9id_jnA この放送は 株式会社ドワンゴ の実施するニコニコ ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/2DacDYB6jVs/default_live.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/2DacDYB6jVs/mqdefault_live.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/2DacDYB6jVs/hqdefault_live.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Okayu Ch. 猫又おかゆ",
"liveBroadcastContent": "live",
"publishTime": "2021-11-29T06:00:03Z"
}
}
]
}
First of all I would suggest you remove the key from your code snippet, and make sure to make the key you've accidentally shared in here invalid from your google api admin panel.
However when I try to run your fetch, I get the expected result. I think you are victim to console.log not showing everything, see: console.log message is truncated
so i tried User Avatar shows up in Thumbnail here's my code
if (generalChannel) {
await lib.discord.channels['#0.0.3'].messages.create({
channel_id: generalChannel.id,
"content": "",
"tts": false,
"embed": {
"type": "rich",
"title": `Rage Of Destiny`,
"description": `<#!${event.user.id}> Welcome to the Official Rage Of Destiny Discord Server! \n\nWe hope you enjoy your stay\n\nRemember to read #rules unless you wan't Thordin to punish you 😜`,
"color": 0xff2200,
"image": {
"url": `https://media.discordapp.net/attachments/854601844905738260/866527689720070154/welcome-left.jpeg`,
"height": 0,
"width": 0
},
"thumbnail": {
"url": `(message.author.avatarURL())`,
"height": 0,
"width": 0
}
}
});
}
};
but this is not working, did try to search about it but nothing
"thumbnail": {
"url": `(message.author.avatarURL())`,
"height": 0,
"width": 0
}
I have multiple test in my file but I will use the first one as an example.
import React from 'react';
import { shallow } from 'enzyme';
import Event from '../Event';
import { mockData } from '../mock-data';
describe('<Event /> component', () => {
let EventWrapper;
beforeAll(() => {
EventWrapper = shallow(<Event event={mockData} />)
})
test('rendered event container', () => {
expect(EventWrapper.find('.event-container')).toHaveLength(1);
});
})
Then here is my React Component file
import React, { Component } from 'react';
class Event extends Component {
state = {
showingDetails: false
}
eventDetails = () => {
const showingDetails = this.state.showingDetails;
if (showingDetails === false) {
this.setState({
showingDetails: true
})
} else {
this.setState({
showingDetails: false
})
}
};
render() {
const { event } = this.props;
const eventISODateTime = new Date(event.start.dateTime);
const eventDate = eventISODateTime.toDateString();
const eventTime = eventISODateTime.toTimeString();
const eventTimeFormatted = `${eventTime.slice(0, 5)} ${eventTime.slice(18)}`;
return <div className="event-container">
<h1 className="event-summary">{event.summary}</h1>
<p className="event-date">{eventDate} </p>
<p className="event-time">{eventTimeFormatted}</p>
<p className="event-location">{event.location}</p>
{this.state.showingDetails && (
<div className="event-details">
<h3 className="about-event">About event:</h3>
<a className="details-link" target="_blank" rel="noreferrer" href={event.htmlLink}>See details on Google Calendar</a>
<p className="event-description">{event.description}</p>
</div>
)}
<button className="show-hide" onClick={() => this.eventDetails()}> {this.state.showingDetails ? 'hide description' : 'show description'} </button>
</div >
}
}
export default Event;
I defined dateTime inside of the render().
I using the same { mockData } for each file . When I load my site either in localhost or on Github gh-pages it works fine and displays the data correctly, so it is just giving me an error when running the test 'npm run test'
Here is the mockData file I am pulling from
const mockData = [
{
"kind": "calendar#event",
"etag": "\"3181161784712000\"",
"id": "4eahs9ghkhrvkld72hogu9ph3e_20200519T140000Z",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NGVhaHM5Z2hraHJ2a2xkNzJob2d1OXBoM2VfMjAyMDA1MTlUMTQwMDAwWiBmdWxsc3RhY2t3ZWJkZXZAY2FyZWVyZm91bmRyeS5jb20",
"created": "2020-05-19T19:17:46.000Z",
"updated": "2020-05-27T12:01:32.356Z",
"summary": "Learn JavaScript",
"description": "Have you wondered how you can ask Google to show you the list of the top ten must-see places in London? And how Google presents you the list? How can you submit the details of an application? Well, JavaScript is doing these. :) \n\nJavascript offers interactivity to a dull, static website. Come, learn JavaScript with us and make those beautiful websites.",
"location": "London, UK",
"creator": {
"email": "fullstackwebdev#careerfoundry.com",
"self": true
},
"organizer": {
"email": "fullstackwebdev#careerfoundry.com",
"self": true
},
"start": {
"dateTime": "2020-05-19T16:00:00+02:00",
"timeZone": "Europe/Berlin"
},
"end": {
"dateTime": "2020-05-19T17:00:00+02:00",
"timeZone": "Europe/Berlin"
},
"recurringEventId": "4eahs9ghkhrvkld72hogu9ph3e",
"originalStartTime": {
"dateTime": "2020-05-19T16:00:00+02:00",
"timeZone": "Europe/Berlin"
},
"iCalUID": "4eahs9ghkhrvkld72hogu9ph3e#google.com",
"sequence": 0,
"reminders": {
"useDefault": true
},
"eventType": "default"
},
{
"kind": "calendar#event",
"etag": "\"3181159875584000\"",
"id": "3qtd6uscq4tsi6gc7nmmtpqlct_20200520T120000Z",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=M3F0ZDZ1c2NxNHRzaTZnYzdubW10cHFsY3RfMjAyMDA1MjBUMTIwMDAwWiBmdWxsc3RhY2t3ZWJkZXZAY2FyZWVyZm91bmRyeS5jb20",
"created": "2020-05-19T19:14:30.000Z",
"updated": "2020-05-27T11:45:37.792Z",
"summary": "React is Fun",
"description": "Love HTML, CSS, and JS? Want to become a cool front-end developer? \n\nReact is one of the most popular front-end frameworks. There is a huge number of job openings for React developers in most cities. \n\nJoin us in our free React training sessions and give your career a new direction. ",
"location": "Berlin, Germany",
"creator": {
"email": "fullstackwebdev#careerfoundry.com",
"self": true
},
"organizer": {
"email": "fullstackwebdev#careerfoundry.com",
"self": true
},
"start": {
"dateTime": "2020-05-20T14:00:00+02:00",
"timeZone": "Europe/Berlin"
},
"end": {
"dateTime": "2020-05-20T15:00:00+02:00",
"timeZone": "Europe/Berlin"
},
"recurringEventId": "3qtd6uscq4tsi6gc7nmmtpqlct",
"originalStartTime": {
"dateTime": "2020-05-20T14:00:00+02:00",
"timeZone": "Europe/Berlin"
},
"iCalUID": "3qtd6uscq4tsi6gc7nmmtpqlct#google.com",
"sequence": 0,
"reminders": {
"useDefault": true
},
"eventType": "default"
},
{
"kind": "calendar#event",
"etag": "\"3181161784712000\"",
"id": "4eahs9ghkhrvkld72hogu9ph3e_20200521T140000Z",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NGVhaHM5Z2hraHJ2a2xkNzJob2d1OXBoM2VfMjAyMDA1MjFUMTQwMDAwWiBmdWxsc3RhY2t3ZWJkZXZAY2FyZWVyZm91bmRyeS5jb20",
"created": "2020-05-19T19:17:46.000Z",
"updated": "2020-05-27T12:01:32.356Z",
"summary": "Learn JavaScript",
"description": "Have you wondered how you can ask Google to show you the list of the top ten must-see places in London? And how Google presents you the list? How can you submit the details of an application? Well, JavaScript is doing these. :) \n\nJavascript offers interactivity to a dull, static website. Come, learn JavaScript with us and make those beautiful websites.",
"location": "London, UK",
"creator": {
"email": "fullstackwebdev#careerfoundry.com",
"self": true
},
"organizer": {
"email": "fullstackwebdev#careerfoundry.com",
"self": true
},
"start": {
"dateTime": "2020-05-21T16:00:00+02:00",
"timeZone": "Europe/Berlin"
},
"end": {
"dateTime": "2020-05-21T17:00:00+02:00",
"timeZone": "Europe/Berlin"
},
"recurringEventId": "4eahs9ghkhrvkld72hogu9ph3e",
"originalStartTime": {
"dateTime": "2020-05-21T16:00:00+02:00",
"timeZone": "Europe/Berlin"
},
"iCalUID": "4eahs9ghkhrvkld72hogu9ph3e#google.com",
"sequence": 0,
"reminders": {
"useDefault": true
},
"eventType": "default"
},
];
export { mockData };
I have an array of objects that look like the object below and I am trying to render a list. I have other screens that render lists of the same shape in the same manner. I cannot figure out why I am getting an error with this array. The promise is handled correctly and the data is set to the state. The data that I am trying to render is an array.
The error
[Unhandled promise rejection: Error: Objects are not valid as a React child (found: object with keys {external_urls, href, id, name, type, uri}). If you meant to render a collection of children, use an array instead.]
The array: this.state.playlist.items
Array [
Object {
"added_at": "2020-12-06T06:43:39Z",
"added_by": Object {
"external_urls": Object {
"spotify": "https://open.spotify.com/user/",
},
"href": "https://api.spotify.com/v1/users/",
"id": "",
"type": "user",
"uri": "spotify:user:"",
},
"is_local": false,
"primary_color": null,
"track": Object {
"album": Object {
"album_type": "single",
"artists": Array [
Object {
"external_urls": Object {
"spotify": "https://open.spotify.com/artist/4iMO20EPodreIaEl8qW66y",
},
"href": "https://api.spotify.com/v1/artists/4iMO20EPodreIaEl8qW66y",
"id": "4iMO20EPodreIaEl8qW66y",
"name": "Still Woozy",
"type": "artist",
"uri": "spotify:artist:4iMO20EPodreIaEl8qW66y",
},
],
"external_urls": Object {
"spotify": "https://open.spotify.com/album/5mlgzPatuoMGqqHsPIofKr",
},
"href": "https://api.spotify.com/v1/albums/5mlgzPatuoMGqqHsPIofKr",
"id": "5mlgzPatuoMGqqHsPIofKr",
"images": Array [
Object {
"height": 640,
"url": "https://i.scdn.co/image/ab67616d0000b2738d23ae740afca14480db70c8",
"width": 640,
},
Object {
"height": 300,
"url": "https://i.scdn.co/image/ab67616d00001e028d23ae740afca14480db70c8",
"width": 300,
},
Object {
"height": 64,
"url": "https://i.scdn.co/image/ab67616d000048518d23ae740afca14480db70c8",
"width": 64,
},
],
"name": "Wolfcat",
"release_date": "2017-08-31",
"release_date_precision": "day",
"total_tracks": 1,
"type": "album",
"uri": "spotify:album:5mlgzPatuoMGqqHsPIofKr",
},
"artists": Array [
Object {
"external_urls": Object {
"spotify": "https://open.spotify.com/artist/4iMO20EPodreIaEl8qW66y",
},
"href": "https://api.spotify.com/v1/artists/4iMO20EPodreIaEl8qW66y",
"id": "4iMO20EPodreIaEl8qW66y",
"name": "Still Woozy",
"type": "artist",
"uri": "spotify:artist:4iMO20EPodreIaEl8qW66y",
},
],
"disc_number": 1,
"duration_ms": 174221,
"episode": false,
"explicit": true,
"external_ids": Object {
"isrc": "QZ9JZ1701572",
},
"external_urls": Object {
"spotify": "https://open.spotify.com/track/1Hu2OypX8tMPwBcCUaAeO4",
},
"href": "https://api.spotify.com/v1/tracks/1Hu2OypX8tMPwBcCUaAeO4",
"id": "1Hu2OypX8tMPwBcCUaAeO4",
"is_local": false,
"name": "Wolfcat",
"popularity": 63,
"preview_url": "https://p.scdn.co/mp3-preview/b6ac80e632d0c15e097d43083a738bf69ac8bc12?cid=5673f7c36ce34a669e8805ca91f3b103",
"track": true,
"track_number": 1,
"type": "track",
"uri": "spotify:track:1Hu2OypX8tMPwBcCUaAeO4",
},
"video_thumbnail": Object {
"url": null,
},
},
Rendering the list
<View style={{marginBottom: 310}}>
<FlatList
data = {this.state.playlist.items}
renderItem = {({ item }) => (
<ListItem bottomDivider >
<Avatar size={80} source={{uri: item.track.album.images[0].url}} />
<ListItem.Content>
<ListItem.Title>{item.track.name}</ListItem.Title>
<ListItem.Subtitle>{item.track.album.artists[0]}</ListItem.Subtitle>
</ListItem.Content>
<ListItem.Chevron />
</ListItem>
)}
keyExtractor={item => item.track.id}
/>
</View>
The error message is actually quite explanatory. If you change your code in following way, for instance:
<ListItem.Subtitle>{item.track.album.artists[0].name}</ListItem.Subtitle>
it should work. React does not allow to use an Object as a child (item.track.album.artists[0] is Object). Only primitive types are allowed (typically String or Number). item.track.album.artists[0].name is String.
I use simple method, such us
buildApiRequest('GET','/youtube/v3/channels',
{
'mySubscribers': true,
'maxResults': MaxResult,
'part': 'snippet'
}
It works, but in result I can't see how I can sort them.
I need last MaxResult subscribers, and I wanna sort them by join date on my channel.
The subscriptions.list and subscriberSnippet with myRecentSubscribers set to true returns a list of resent subscribers to your channel. It does not return all of them.
If you check the response you will notice there is no date. You will not be able to see when someone subscribed.
"subscriberSnippet": {
"title": string,
"description": string,
"channelId": string,
"thumbnails": {
(key): {
"url": string,0
"width": unsigned integer,
"height": unsigned integer
}
}
The order parameter should allow you to order them by title you cant change the parameter it uses to sort on.
buildApiRequest('GET',
'/youtube/v3/subscriptions',
{'part': 'subscriberSnippet',
'myRecentSubscribers': 'true',
'order', 'alphabetical'});
Response
{
"kind": "youtube#subscriptionListResponse",
"etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/wLsZnuAVb0T9-bdRdCnreaWBHNM\"",
"nextPageToken": "CAUQAA",
"pageInfo": {
"totalResults": 7,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#subscription",
"etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/3_huGriwUWV4fbbzcclmEoNYJ3w\"",
"id": "moP_YQe1scKJgrI0udrz3B2tJTmRwvz4ev3R2_L4JmI",
"subscriberSnippet": {
"title": "Kortney W",
"description": "",
"channelId": "UC33FFHTxOZ6NRZAp9afsRBw",
"thumbnails": {
"default": {
"url": "https://yt3.ggpht.com/-T6Sn1ur07bk/AAAAAAAAAAI/AAAAAAAAAAA/BSSSRckoD4k/s88-c-k-no-mo-rj-c0xffffff/photo.jpg"
},
"medium": {
"url": "https://yt3.ggpht.com/-T6Sn1ur07bk/AAAAAAAAAAI/AAAAAAAAAAA/BSSSRckoD4k/s240-c-k-no-mo-rj-c0xffffff/photo.jpg"
},
"high": {
"url": "https://yt3.ggpht.com/-T6Sn1ur07bk/AAAAAAAAAAI/AAAAAAAAAAA/BSSSRckoD4k/s800-c-k-no-mo-rj-c0xffffff/photo.jpg"
}
}
}
},
{
"kind": "youtube#subscription",
"etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/UVJds9Q4d24quS-sEG8Qw_3MBzU\"",
"id": "gI5QI3teCs8unbR7__8oVg7KlRfOtWQYR70kXNkS4PY",
"subscriberSnippet": {
"title": "TheCorty",
"description": "",
"channelId": "UC-0O3PZ0VPNySP2bNFAPDIA",
"thumbnails": {
"default": {
"url": "https://yt3.ggpht.com/-8C6KXmEqDho/AAAAAAAAAAI/AAAAAAAAAAA/1roVNa2yF0o/s88-c-k-no-mo-rj-c0xffffff/photo.jpg"
},
"medium": {
"url": "https://yt3.ggpht.com/-8C6KXmEqDho/AAAAAAAAAAI/AAAAAAAAAAA/1roVNa2yF0o/s240-c-k-no-mo-rj-c0xffffff/photo.jpg"
},
"high": {
"url": "https://yt3.ggpht.com/-8C6KXmEqDho/AAAAAAAAAAI/AAAAAAAAAAA/1roVNa2yF0o/s800-c-k-no-mo-rj-c0xffffff/photo.jpg"
}
}
}
}
]
}
this is only going to work if you own the channel
it does not return all of your subscribers just the most recent.
There is no date in the response you cant sort by date.
you can test this here just make sure you authenticate to the correct channel