Related
I have the following string and I'm trying to display the information from specific start word to specific end word:
Protocolo de medición
\r\n\r\nEnsayador disruptivo
\r\nDPA 75C Versión: 1.07
\r\nNúmero de serie: 1101908010
\r\n11/02/2022 02:15\r\n_____________________________
\r\n\r\nInformación sobre el ensayo
\r\n\r\nNombre de protocolo: .......................
\r\nNúmero de muestra: 0569.1
\r\nMedición según norma: ASTM D1816:2004 2mm
\r\nForma de electrodos: Forma de seta
\r\nDistancia entre electrodos: 2 mm
\r\nFrec. del ensayo: 60 Hz\r\n\r\n_____________________________
\r\n\r\nConfig. según norma
\r\n\r\nDiámetro de los electrodos: 36 mm\r\n\r\n_____________________________
\r\n\r\nValores de medición
\r\n\r\nTemperatura: 20 °C
\r\n\r\nMedición 1: 60.6 kV
\r\nMedición 2: 72.7 kV\r\nMedición 3: >75.0 kV
\r\nMedición 4: 54.7 kV\r\nMedición 5: 66.4 kV
\r\n\r\nValor medio: 65.9 kV
\r\nDesviación estándar: 8.4 kV
\r\nDesviación estándar/val. medio: 12.8 %
\r\n\r\n\r\nEnsayo correctamente realiz.
\r\n\r\n\r\nEnsayo ejecutado por: .......................
The code should find the string line
\r\nNúmero de muestra: 0569.1 \r\
Final result should be
0569.1
I tried this code only display the word searched
#article.description.match(/Número de muestra:\b/)
I tried this code and works but i need to count the number from and to
<%= #article.description.slice(249..260) %>
What i want is write the FROM WORD - TO WORD string without typing the index word.
If the string you are looking to capture always has a line end character after it at some point you can do:
data = #article.description.match(/Número de muestra:*(.*)$/)
returns a Match object like:
#<MatchData "Número de muestra: 0569.1" 1:"0569.1">
you can then access the match with
data[1]
# => "0569.1"
The Match object stores the matching string in data[0] and the first capture is in data[1]. In the regexp we are using the .* matches the spaces after the string Número de muestra:. The (.*) matches any characters after the spaces. The $ matches the end of line character. Anything that matches what is between the parens () gets stored as matches in the Match object.
I have one problem, when i try to get URL of licensed video i get fail.
Its not return any video URL from licensed video.
For example:
"https://www.youtube.com/watch?v=3O1_3zBUKM8"
When i tried to get url i get fail.
// THIS CODE https://gist.github.com/el3zahaby/9e60f1ae3168c38cc0f0054c15cd6a83
I tried to find solution but there is no answear:
-Most of videos not getting VideoUrl from YouTube
-How do I get video info for Youtube Vevo Videos?
How its possible ??
if I want to get urls of all the videos, so what's the solution ??
Since the videoId you're requesting has restrictions for embed it, you wont be able to get further information.
In the request you get the following result:
[
{
"itct": "CAEQu2kiEwjGrqPtqrvgAhXL3WAKHTzzB-8op5UD",
"watermark": ",http://s.ytimg.com/yts/img/watermark/youtube_watermark-vflHX6b6E.png,http://s.ytimg.com/yts/img/watermark/youtube_hd_watermark-vflAzLcD6.png",
"ldpj": "-2",
"apiary_host_firstparty": "",
"timestamp": "1550151100",
"url_encoded_fmt_stream_map": "",
"apiary_host": "",
"author": "NaughtyBoyVEVO",
"video_id": "3O1_3zBUKM8",
"external_play_video": "1",
"subreason": "",
"host_language": "en",
"root_ve_type": "51879",
"cr": "US",
"length_seconds": "244",
"token": "1",
"vss_host": "s.youtube.com",
"csi_page_type": "embed",
"title": "Naughty Boy - La la la ft. Sam Smith",
"t": "1",
"fflags": "html5_min_buffer_to_resume=6&html5_disable_extra_update_resource=true&ad_to_video_use_gel=true&live_fresca_v2=true&html5_streaming_xhr_buffer_mdat=true&html5_license_constraint_delay=5000&disable_client_side_midroll_freq_capping_nonpc=true&html5_request_size_padding_secs=3.0&use_fast_fade_in_0s=true&html5_tight_max_buffer_allowed_impaired_time=0.0&mweb_enable_instream_ui_refresh=true&spacecast_uniplayer_decorate_manifest=true&bulleit_round_up_tsla=true&mweb_undim_skip_button_on_ad_pause=true&html5_connect_timeout_secs=7.0&html5_post_interrupt_readahead=20&html5_subsegment_readahead_target_buffer_health_secs=0.5&tv_html5_bulleit_unify_adinfo=true&html5_platform_minimum_readahead_seconds=0.0&show_thumbnail_on_standard=true&defer_player_config_and_threed_deciders=true&html5_tv_bearer=true&html5_video_tbd_min_kb=0&html5_peak_shave=true&use_survey_skip_in_0s=true&dynamic_ad_break_seek_threshold_sec=0&ima_disable_reset_active_media_load_timeout=true&html5_reason_reporting_migration=true&html5_use_adaptive_live_readahead=true&unplugged_tvhtml5_video_preload_on_focus_delay_ms=0&html5_log_playback_rate_change_killswitch=true&html5_default_ad_gain=0.5&html5_desktop_vr180_allow_panning=true&html5_minimum_readahead_seconds=0.0&html5_ad_no_buffer_abort_after_skippable=true&postroll_notify_time_seconds=5&html5_request_sizing_multiplier=0.8&mweb_bulleit_show_ad_top_bar_for_phones=true&html5_enable_webm_cue_refactor=true&attach_child_on_gel_web=true&log_playback_associated_web=true&html5_live_abr_repredict_fraction=0.0&use_local_interactions_library=true&html5_df_downgrade_thresh=0.0&html5_ignore_public_setPlaybackQuality=true&html5_jumbo_ull_nonstreaming_mffa_ms=4000&html5_get_video_info_timeout_ms=30000&html5_suspend_manifest_on_pause=true&html5_subsegment_readahead_require_whitelist=true&html5_av1_thresh_lcc=0&html5_store_xhr_headers_readable=true&html5_subsegment_readahead_min_load_speed=1.5&desktop_videowall_companion_wta_support=true&set_interstitial_advertisers_question_text=true&bulleit_update_tsla_cookie=true&use_new_skip_icon=true&html5_live_pin_to_tail=true&android_early_fetch_for_autoplay=true&html5_subsegment_readahead_min_buffer_health_secs_on_timeout=0.1&html5_live_4k_more_buffer=true&mweb_playsinline=true&html5_vp9_live_blacklist_edge=true&html5_msi_error_fallback=true&html5_media_fullscreen=true&mweb_muted_autoplay=true&dynamic_ad_break_pause_threshold_sec=0&delay_ads_gvi_call_on_bulleit_living_room_ms=0&html5_deadzone_multiplier=1.0&uniplayer_dbp=true&html5_disable_non_contiguous=true&use_forced_linebreak_preskip_text=true&deprecate_vss_dallas_cache=true&kevlar_miniplayer=true&html5_new_queueing=true&html5_live_ultra_low_latency_bandwidth_window=0.0&website_actions_throttle_percentage=1.0&desktop_cleanup_companion_on_instream_begin=true&enable_website_actions_on_mweb=true&html5_variability_discount=0.5&html5_widevine_hw_secure_all=true&html5_parse_inline_fallback_host=true&html5_live_abr_head_miss_fraction=0.0&preskip_button_style_ads_backend=countdown_next_to_thumbnail&show_thumbnail_behind_ypc_offer_module=true&html5_manifestless_synchronized=true&mpu_visible_threshold_count=2&enable_kevlar_action_companion_cleanup=true&mweb_autonav=true&tvhtml5_min_readbehind_secs=20&mweb_muted_autoplay_animation=shrink&doubleclick_gpt_retagging=true&html5_manifestless_no_redundant_seek_to_head=true&html5_live_normal_latency_bandwidth_window=0.0&show_interstitial_white=true&player_unified_fullscreen_transitions=true&html5_bmffparser_use_fast_read_string=true&html5_maximum_readahead_seconds=0.0&html5_min_readbehind_cap_secs=60&html5_request_size_min_secs=0.0&html5_remove_pause=false&html5_hls_initial_bitrate=0&enable_bulleit_mweb_gaming_ui=true&html5_use_hasAdvanced_for_pbs=true&interaction_click_on_gel_web=true&html5_aspect_from_adaptive_format=true&mweb_playsinline_webview=true&use_always_dimmed_skip_in_bulleit_web=true&html5_disable_move_pssh_to_moov=true&provide_default_wta_reasons=true&html5_probe_media_capabilities=true&html5_manifestless_always_redux=true&fast_autonav_in_background=true&html5_incremental_parser_buffer_duration_secs=1.5&variable_buffer_timeout_ms=0&enable_static_font_size_on_text_only_preview=true&html5_ignore_updates_before_initial_ping=true&show_interstitial_for_3s=true&vmap_enabled_living_room=true&html5_log_hls_video_height_change_as_format_change=true&turn_down_serialized_player_request_for_bulleit_living_room=true&live_readahead_seconds_multiplier=0.8&preskip_countdown_font_size=&html5_max_av_sync_drift=50&enable_live_premieres_vss_live_type_lp=true&web_player_api_logging_fraction=0.01&web_player_assume_format3_available=true&use_touch_events_for_bulleit_mweb=true&html5_inline_video_quality_survey=true&html5_suspend_loader=true&enable_bulleit_for_web_gaming=true&html5_disable_audio_slicing=true&html5_elbow_tracking_tweaks=true&html5_spherical_bicubic_mode=1&player_destroy_old_version=true&html5_use_streaming_xhr_abort_support=true&html5_player_autonav_logging=true&skip_restore_on_abandon_in_bulleit=true&bulleit_web_dim_skip_using_css=true&web_player_response_overlay_parsing=false&html5_dont_predict_end_time_in_past=true&html5_repredict_interval_secs=0.0&html5_vss_live_mode_killswitch=true&bulleit_mimic_ima_player_api_calls=true&visibility_error_html_dump_sample_rate=0.01&html5_playbackmanager_enable_notify_new_drm_info=true&html5_min_upgrade_health=0&use_refreshed_overlay_buttons=true&html5_max_live_dvr_window_plus_margin_secs=46800.0&html5_delay_initial_loading=true&web_player_sentinel=true&variable_load_timeout_ms=0&enable_overlay_hide_timer_fix=true&bulleit_block_player_pause_until_ad_start=true&set_default_wta_if_missing_for_externs=true&dash_manifest_version=5&bulleit_check_overlay_container_before_show=true&defer_playability_status_fillers=true&html5_waiting_before_ended=true&enable_bulleit_for_mweb=true&autoplay_time=8000&enable_bulleit_ve_single_clickthrough=true&html5_no_shadow_env_data_redux=true&html5_adjust_effective_request_size=true&mweb_cougar_big_controls=true&bulleit_disable_preroll_release_on_dispose=true&html5_default_quality_cap=0&web_logging_max_batch=100&enable_survey_ad_info_dialog=true&fixed_padding_skip_button=true&html5_expire_preloaded_players=true&fix_gpt_pos_params=true&html5_min_has_advanced=true&bulleit_send_engage_ping_on_companion_click=true&variable_buffer_timeout_living_room_ms=0&enable_bulleit_mweb_remix_ui=true&lasr_captions_holdback=true&enable_html5_conversion_ve_reporting=true&bulleit_use_touch_events_for_skip=true&desktop_companion_wta_support=true&enable_brand_companion_on_mweb=true&flex_theater_mode=true&youtubei_for_web=true&sdk_ad_prefetch_time_seconds=-1&playready_first_play_expiration=-1&html5_max_buffer_duration=120&max_resolution_for_white_noise=360&desktop_image_companion_wta_support=true&html5_subsegment_readahead_load_speed_check_interval=0.5&html5_manifestless_interpolate=true&html5_enable_widevine_key_rotation=true&enable_embed_autoplay_delay=true&enable_text_ad_overlay_link_fix=true&html5_request_size_max_secs=31&html5_disable_subscribe_new_vis=true&html5_enable_embedded_player_visibility_signals=true&html5_creativeless_vast_on_ima=true&mweb_cougar=true&stop_using_ima_sdk_gpt_request_activity=true&html5_background_cap_idle_secs=60&html5_qoe_bearer=true&html5_stale_dash_manifest_retry_factor=1.0&html5_new_seeking=true&html5_min_secs_between_format_selections=8.0&html5_incremental_parser_coalesce_slice_buffers=true&ad_duration_threshold_for_showing_endcap_seconds=15&bulleit_use_video_end_cuerange_for_completion=true&html5_cut_vss_on_visibility=true&html5_subsegment_readahead_seek_latency_fudge=0.5&embed_new_info_bar=true&html5_sticky_reduces_discount_by=0.0&html5_fludd_suspend=true&web_player_music_visualizer_treatment=fake&html5_no_audio_append_cap=true&html5_autonav_quality_cap=0&html5_ultra_low_latency_streaming_responses=true&ima_video_ad_with_overlay_class_logging_percentage=0.01&html5_frame_accurate_seek_limit=3&html5_subsegment_readahead_timeout_secs=2.0&kevlar_miniplayer_button=true&html5_shrink_live_timestamps=true&enable_mute_ad_endpoint_resolution_on_bulleit=true&html5_release_mediakey_after_load=true&interaction_screen_on_gel_web=true&process_extensions_in_vast_wrappers_for_survey_ads=true&html5_enable_non_diegetic=true&desktop_action_companion_wta_support=true&allow_midrolls_on_watch_resume_in_bulleit=true&enable_composite_ad_player_presentation_for_bulleit=true&html5_get_video_info_promiseajax=true&bulleit_register_cue_range_events_before_ad_init=true&html5_live_low_latency_bandwidth_window=0.0&html5_fallbacks_delay_primary_probes=true&show_countdown_on_bumper=true&embed_api_deprecation=true&android_attestation_flow=yt_player&enable_simple_preview_for_postrolls_html5=true&html5_probe_primary_delay_base_ms=0&html5_new_vis_fullscreen_and_airplay=true&html5_serverside_biscotti_id_wait_ms=1000&enable_instream_companion_on_mweb=true&html5_progressive_fallback=true&call_release_video_in_bulleit=true&html5_exile_broken_instances=true&html5_prefer_server_bwe3=true&enable_prefetch_for_postrolls=true&forced_brand_precap_duration_ms=2000&enable_endcap_on_mweb=true&html5_manifestless_captions=true&www_for_videostats=true&send_html5_api_stats_ads_abandon=true&html5_manifestless_request_prediction=true&disable_new_pause_state3=true&web_player_response_playback_tracking_parsing=true&delay_bulleit_media_load_timer=true&html5_disable_preserve_reference=true&tvhtml5_disable_live_prefetch=true&bulleit_use_http_get_by_default_for_get_midroll_info=true&html5_vp9_live_whitelist=true&vss_dni_delayping=0&html5_serverside_call_server_on_biscotti_timeout=true&html5_preload_media=true&html5_jumbo_ull_subsegment_readahead_target=1.3&bulleit_get_midroll_info_timeout_ms=8000&use_full_timing_library=true&disable_client_side_midroll_freq_capping=true&lasr_captions_holdback_counterfactual_id=23737673&html5_live_disable_dg_pacing=true&html5_pause_video_fix=true&html5_gapless=true&html5_log_rebuffer_events=0&bulleit_publish_external_playback_events=true&html5_max_readahead_bandwidth_cap=0&html5_live_no_streaming_impedance_mismatch=true&skip_ad_button_with_thumbnail=true&use_ima_media_selection_in_bulleit=true&html5_dynamic_readahead_growth_rate=0.0&segment_volume_reporting=true&html5_stop_video_in_cancel_playback=true&html5_serverside_call_server_on_biscotti_error=true&disable_survey_interstitial_for_non_bl_surveys_desktop=true&bulleit_extract_delayed_mpu_on_all_placement_init=true&html5_tight_max_buffer_allowed_bandwidth_stddevs=0.0&html5_streaming_xhr_progress_includes_latest=true&enable_bulleit=true&html5_qoe_intercept=&use_new_style=true&html5_optimality_migration=true&html5_probe_secondary_during_timeout_miss_count=2&html5_manifestless_accurate_sliceinfo=true&fix_bulleit_cue_range_seek=true&playready_on_borg=true&external_fullscreen_with_edu=true&html5_vis_upgrades_are_resizes=true&html5_use_media_capabilities=true&html5_pipeline_manifestless=true&mweb_ios_handle_player_click_by_touch_event=true&bulleit_register_placements_in_order=true&king_crimson_player_redux=true&persist_text_on_preview_button=true&enable_bulleit_lidar_integration=true&enable_afv_div_reset_in_kevlar=true&web_player_native_json=true&html5_subsegment_readahead_min_buffer_health_secs=0.25&midroll_notify_time_seconds=5&html5_background_quality_cap=360&html5_no_placeholder_rollbacks=true&html5_seeking_buffering_only_playing=true&web_player_kaios_autoplay=true&sdk_wrapper_levels_allowed=0&allow_live_autoplay=true&html5_variability_full_discount_thresh=3.0&legacy_autoplay_flag=true&html5_widevine_robustness_strings=true&tvhtml5_yongle_quality_cap=0&add_border_to_bulleit_mweb_skip=true&set_interstitial_start_button=true&html5_bandwidth_window_size=0&html5_streaming_xhr_optimize_lengthless_mp4=true&html5_allowable_liveness_drift_chunks=2&enable_overlays_wta=true&ad_video_end_renderer_duration_milliseconds=7000&html5_variability_no_discount_thresh=1.0&desktop_shopping_companion_wta_support=true&html5_probe_live_using_range=true&html5_firefox_ambisonic_opus=true&html5_av1_thresh=0&html5_adaptation_fix=true&web_player_attestation_auth_headers=true&hide_preskip=true&mweb_add_ad_info_button_on_fullscreen_only_devices=true&html5_max_headm_for_streaming_xhr=0&html5_disable_vp8_only_browsers=true&html5_unrewrite_timestamps=true&html5_quality_cap_min_age_secs=0&web_player_sentinel_is_uniplayer=true&kevlar_allow_multistep_video_init=true&bulleit_use_video_ad_div_as_overlay_container=true&lightweight_watch_video_swf=true&html5_hls_min_video_height=0&live_chunk_readahead=3&bulleit_terminate_ad_when_ending_with_commands=true&html5_manifestless_shrink_timestamps=true&html5_incremental_parser_buffer_extra_bytes=16384&html5_ignore_bad_bitrates=true&html5_min_readbehind_secs=0&html5_restrict_streaming_xhr_on_sqless_requests=true&enable_live_premiere_web_player_indicator=true&html5_jumbo_mobile_subsegment_readahead_target=3.0&html5_readahead_ratelimit=3000&html5_decode_to_texture_cap=true&desktop_player_button_tooltip_with_shortcut=true&html5_hfr_quality_cap=0&low_engagement_player_quality_cap=360&html5_playback_data_migration=true&html5_ad_stats_bearer=true&bulleit_use_cue_video_to_reset_on_stop_ad=true&html5_pipeline_ultra_low_latency=true&bulleit_remove_client_side_midroll_reactivation=true",
"ucid": "UCarfuQxcly5bNXIezBgbrcQ",
"csn": "u21lXIblOMu7gwO85p_4Dg",
"no_get_video_log": "1",
"cver": "1.20190213",
"tmi": "1",
"player_response": "{\"playabilityStatus\":{\"status\":\"UNPLAYABLE\",\"reason\":\"This video is unavailable.\",\"errorScreen\":{\"playerErrorMessageRenderer\":{\"reason\":{\"simpleText\":\"This video is unavailable.\"},\"proceedButton\":{\"buttonRenderer\":{\"style\":\"STYLE_PRIMARY\",\"size\":\"SIZE_DEFAULT\",\"isDisabled\":false,\"text\":{\"simpleText\":\"Watch on YouTube\"},\"trackingParams\":\"CAUQ8FsiEwjGrqPtqrvgAhXL3WAKHTzzB-8op5UD\"}},\"thumbnail\":{\"thumbnails\":[{\"url\":\"//s.ytimg.com/yts/img/meh7-vflGevej7.png\",\"width\":140,\"height\":100}]},\"icon\":{\"iconType\":\"ERROR_OUTLINE\"}}}},\"videoDetails\":{\"videoId\":\"3O1_3zBUKM8\",\"title\":\"Naughty Boy - La la la ft. Sam Smith\",\"lengthSeconds\":\"244\",\"keywords\":[\"Naughty\",\"Boy\",\"La\",\"Virgin\",\"Pop\",\"Naughty Boy\",\"NB\",\"Hotel Cabana\",\"HC\",\"Sam Smith\",\"LaLaLa\",\"La La La\",\"The Brits\",\"Brits 2014\",\"Best Single\"],\"channelId\":\"UCarfuQxcly5bNXIezBgbrcQ\",\"isOwnerViewing\":false,\"shortDescription\":\"From Naughty Boy's debut album \\\"Hotel Cabana\\\"\\nAVAILABLE NOW - Download: http://po.st/HCiTunes \\n\\nWatch the Hotel Cabana trailer at http://www.hotel-cabana.com \\n\\nFollow Naughty Boy\\nhttp://www.facebook.com/NBoyMusic \\nhttp://www.twitter.com/naughtyboymusic\\n\\nVideo Directed by Ian Pons Jewell\\n\\nMusic video by Naughty Boy Performing La La La. © 2013\\nNaughty Boy Recordings Ltd, under exclusive licence to Virgin Records Ltd.\",\"isCrawlable\":true,\"thumbnail\":{\"thumbnails\":[{\"url\":\"http://i.ytimg.com/vi/3O1_3zBUKM8/hqdefault.jpg?sqp=-oaymwEiCKgBEF5IWvKriqkDFQgBFQAAAAAYASUAAMhCPQCAokN4AQ==\\u0026rs=AOn4CLDPD4kWz9Ka5D6E7vl5ZLrQi5jfKQ\",\"width\":168,\"height\":94},{\"url\":\"http://i.ytimg.com/vi/3O1_3zBUKM8/hqdefault.jpg?sqp=-oaymwEiCMQBEG5IWvKriqkDFQgBFQAAAAAYASUAAMhCPQCAokN4AQ==\\u0026rs=AOn4CLDANMwzETmpjKzsddzPGEtPpOAW_g\",\"width\":196,\"height\":110},{\"url\":\"http://i.ytimg.com/vi/3O1_3zBUKM8/hqdefault.jpg?sqp=-oaymwEjCPYBEIoBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=\\u0026rs=AOn4CLD7_I4y877ghNH4H-J5F8npWrtL3g\",\"width\":246,\"height\":138},{\"url\":\"http://i.ytimg.com/vi/3O1_3zBUKM8/hqdefault.jpg?sqp=-oaymwEjCNACELwBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=\\u0026rs=AOn4CLDmleiZwXsglwaqiwxakgHNs5bVEA\",\"width\":336,\"height\":188}]},\"averageRating\":4.7239766,\"allowRatings\":true,\"viewCount\":\"944097200\",\"author\":\"NaughtyBoyVEVO\",\"isPrivate\":false,\"isUnpluggedCorpus\":false,\"isLiveContent\":false},\"messages\":[{\"mealbarPromoRenderer\":{\"messageTexts\":[{\"runs\":[{\"text\":\"Household sharing included. No complicated set-up. Unlimited DVR storage space. Cancel anytime.\"}]}],\"actionButton\":{\"buttonRenderer\":{\"style\":\"STYLE_PRIMARY\",\"size\":\"SIZE_DEFAULT\",\"text\":{\"runs\":[{\"text\":\"Try it free\"}]},\"navigationEndpoint\":{\"clickTrackingParams\":\"CAQQ7G8iEwjGrqPtqrvgAhXL3WAKHTzzB-8op5UD\",\"urlEndpoint\":{\"url\":\"https://tv.youtube.com/?utm_source=dmea\\u0026utm_medium=np\\u0026utm_campaign=dmea_evglo19h\\u0026pid=dmea-acq-u-2evgloh\"}},\"trackingParams\":\"CAQQ7G8iEwjGrqPtqrvgAhXL3WAKHTzzB-8op5UD\"}},\"dismissButton\":{\"buttonRenderer\":{\"style\":\"STYLE_BLUE_TEXT\",\"size\":\"SIZE_DEFAULT\",\"text\":{\"runs\":[{\"text\":\"No thanks\"}]},\"serviceEndpoint\":{\"clickTrackingParams\":\"CAMQ7W8iEwjGrqPtqrvgAhXL3WAKHTzzB-8op5UD\",\"feedbackEndpoint\":{\"feedbackToken\":\"AB9zfpJ28dV1uTmBv3-KAOkp1B4LWrc0l7aDyhooLNgKoKOIb4YIljQzt_xpRIY4s3FdAHP7Y9Fs82kdPNynErGmtWpoN08N_tB89C_iXbmVfGX2cBsVI9jYefRjrXMvrCsLYF9EB6GdbFkJG0QRV_d6yweeO8afwg\",\"uiActions\":{\"hideEnclosingContainer\":true}}},\"trackingParams\":\"CAMQ7W8iEwjGrqPtqrvgAhXL3WAKHTzzB-8op5UD\"}},\"triggerCondition\":\"TRIGGER_CONDITION_POST_AD\",\"style\":\"STYLE_MESSAGE\",\"trackingParams\":\"CAIQ42kYACITCMauo-2qu-ACFcvdYAodPPMH7yinlQM=\",\"impressionEndpoints\":[{\"clickTrackingParams\":\"CAIQ42kYACITCMauo-2qu-ACFcvdYAodPPMH7yinlQM=\",\"feedbackEndpoint\":{\"feedbackToken\":\"AB9zfpI_vFbKZTz2susb8fZ1ZN5ssfCrX8Yvphgc1zC6CZbPuuJBBSORpY_gOQMva2RzszXoLTPHxWk1QpPiklJ_Us4Dwogy2x2O8whkiigVfJ262DjwN-Cnv5S5qqZK47TOsy-lbTMkZAmNkQpbFnLbELAvObwWOw\",\"uiActions\":{\"hideEnclosingContainer\":false}}}],\"isVisible\":true,\"messageTitle\":{\"runs\":[{\"text\":\"YouTube TV - No long term contract\"}]}}}],\"adSafetyReason\":{\"isEmbed\":true,\"isRemarketingEnabled\":true,\"isFocEnabled\":true}}",
"innertube_api_key": "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",
"idpj": "-2",
"c": "WEB",
"enablecsi": "1",
"account_playback_token": "QUFFLUhqbFloSXVCbmZUOHI2ZkJPZ1VxV252MEt6RXlGd3xBQ3Jtc0ttWEtPeDdiVVB1akZxdVRvbS1PanZQMVZzcXdXaGNPa1F6d2dINWtoWXFpaEVkTnhycm1pMWZwaEZ0MHd1ckNnZXFWLXVTWjVTb3ZyM210bkhjU0tObEpNZjM4d3U0NjVnaDBfQ0JfM3g4VGs5LWRadw==",
"player_error_log_fraction": "1.0",
"fexp": "23710476,23733013,23735285,23735347,23736684,23737832,23744176,23750564,23751767,23752869,23755886,23755898,23758087,23758204,23759539,23760558,23761607,23762063,23762649,23770908,23775608,23776321,23779065,23780478,23783369,23783454,23785342,23787227,23788290,23788839,23789247,23789643,23791498,23791618,23791648,23792619,23794641,23794899,23795144,9449243,9452649,9471239,9474461,9475671,9479112",
"errorcode": "150",
"innertube_api_version": "v1",
"gapi_hint_params": "m;/_/scs/abc-static/_/js/k=gapi.gapi.en.Qyhlf-E27OQ.O/rt=j/d=1/rs=AHpOoo_77KcTN4WVhdQMqIfKBMTqlRW8yg/m=__features__",
"fmt_list": "",
"thumbnail_url": "http://i.ytimg.com/vi/3O1_3zBUKM8/default.jpg",
"reason": "This video is unavailable.",
"hl": "en_US",
"xhr_apiary_host": "youtubei.youtube.com",
"errordetail": "0",
"innertube_context_client_version": "1.20190213",
"status": "fail",
"error": true,
"instagram": "egy.js",
"apiMadeBy": "El-zahaby"
}
]
Check closely the reason and status properties - the player_response property might be useful too.
"reason": "This video is unavailable.",
"status": "fail",
I want to get meta info from fonts. For example: supported languages, version, license etc. How can I do this? It works fine on Mac Fonts app. I need to implement this on iOS.
You can get much of that information using CTFontCopyName. For example, you can print the font's copyright and license like this:
print(CTFontCopyName(font, kCTFontCopyrightNameKey))
print(CTFontCopyName(font, kCTFontLicenseNameKey))
The key constants are of the format kCTFont***NameKey and are declared in CTFont.h.
You can get the supported languages using CTFontCopySupportedLanguages, but you get a list of BCP-47 language identifiers:
import CoreText
import Foundation
let font = CTFontCreateWithName("Helvetica" as CFString, 12, nil)
let languageIds = CTFontCopySupportedLanguages(font) as! [String]
print(languageIds.joined(separator: ", "))
// Output:
af, agq, ak, asa, ast, az, bas, be, bem, bez, bg, bm, br, bs, ca, ce, cgg, cs, cy, da, dav, de, dje, dsb, dyo, ebu, el, en, eo, es, et, eu, ewo, fi, fil, fo, fr, fur, fy, ga, gd, gl, gsw, guz, gv, haw, hr, hsb, hu, id, ig, is, it, jmc, ka, kam, kde, kea, khq, ki, kk, kl, kln, ksb, ksf, ksh, kw, lag, lb, lg, lkt, ln, lt, lu, luo, luy, lv, mas, mer, mfe, mg, mgh, mgo, mk, mn, ms, mt, naq, nb, nd, nl, nmg, nn, nnh, nyn, om, os, pl, pt, qu, rm, rn, ro, rof, ru, rw, rwk, saq, sbp, se, seh, ses, sg, sk, sl, smn, sn, so, sq, sr, sv, sw, teo, tg, tk, to, tr, twq, uk, uz, vi, vun, wae, xog, yav, yo, zu
You can convert them to human-readable language names by using a Locale. You probably want to use the system locale, chosen by the user:
let myLocale = Locale.autoupdatingCurrent
let languageNames = languageIds.compactMap({ myLocale.localizedString(forLanguageCode: $0) })
print(languageNames.joined(separator: ", "))
// Output:
Afrikaans, Aghem, Akan, Asu, Asturian, Azerbaijani, Basaa, Belarusian, Bemba, Bena, Bulgarian, Bambara, Breton, Bosnian, Catalan, Chechen, Chiga, Czech, Welsh, Danish, Taita, German, Zarma, Lower Sorbian, Jola-Fonyi, Embu, Greek, English, Esperanto, Spanish, Estonian, Basque, Ewondo, Finnish, Filipino, Faroese, French, Friulian, Western Frisian, Irish, Scottish Gaelic, Galician, Swiss German, Gusii, Manx, Hawaiian, Croatian, Upper Sorbian, Hungarian, Indonesian, Igbo, Icelandic, Italian, Machame, Georgian, Kamba, Makonde, Kabuverdianu, Koyra Chiini, Kikuyu, Kazakh, Kalaallisut, Kalenjin, Shambala, Bafia, Colognian, Cornish, Langi, Luxembourgish, Ganda, Lakota, Lingala, Lithuanian, Luba-Katanga, Luo, Luyia, Latvian, Masai, Meru, Morisyen, Malagasy, Makhuwa-Meetto, Metaʼ, Macedonian, Mongolian, Malay, Maltese, Nama, Norwegian Bokmål, North Ndebele, Dutch, Kwasio, Norwegian Nynorsk, Ngiemboon, Nyankole, Oromo, Ossetic, Polish, Portuguese, Quechua, Romansh, Rundi, Romanian, Rombo, Russian, Kinyarwanda, Rwa, Samburu, Sangu, Northern Sami, Sena, Koyraboro Senni, Sango, Slovak, Slovenian, Inari Sami, Shona, Somali, Albanian, Serbian, Swedish, Swahili, Teso, Tajik, Turkmen, Tongan, Turkish, Tasawaq, Ukrainian, Uzbek, Vietnamese, Vunjo, Walser, Soga, Yangben, Yoruba, Zulu
I don't know how to get the scripts supported by a font.
I want to estimate searches for a keyword, limited to a country.
A similar question was asked about 4 years ago: Can I search countries by country_code in AdWords API v201109?.
The accepted answer was: it is not currently possible.
We are now at version v201603, and I wonder if there is a change.
In my specific case I code in Java, but will appreciate the answer in any language, I'll be able to find the relevant Java counterpart.
Update:
To add to the accepted answer, here is the list of the country codes extracted from AdWords CSV file.
private static HashMap<String, Long> COUNTRIES = new HashMap<String, Long>() {
{
put("ad",2020L); //,Andorra
put("ae",2784L); //,United Arab Emirates
put("af",2004L); //,Afghanistan
put("ag",2028L); //,Antigua and Barbuda
put("al",2008L); //,Albania
put("am",2051L); //,Armenia
put("ao",2024L); //,Angola
put("aq",2010L); //,Antarctica
put("ar",2032L); //,Argentina
put("as",2016L); //,American Samoa
put("at",2040L); //,Austria
put("au",2036L); //,Australia
put("az",2031L); //,Azerbaijan
put("ba",2070L); //,Bosnia and Herzegovina
put("bb",2052L); //,Barbados
put("bd",2050L); //,Bangladesh
put("be",2056L); //,Belgium
put("bf",2854L); //,Burkina Faso
put("bg",2100L); //,Bulgaria
put("bh",2048L); //,Bahrain
put("bi",2108L); //,Burundi
put("bj",2204L); //,Benin
put("bn",2096L); //,Brunei
put("bo",2068L); //,Bolivia
put("br",2076L); //,Brazil
put("bs",2044L); //,The Bahamas
put("bt",2064L); //,Bhutan
put("bw",2072L); //,Botswana
put("by",2112L); //,Belarus
put("bz",2084L); //,Belize
put("ca",2124L); //,Canada
put("cc",2166L); //,Cocos (Keeling) Islands
put("cd",2180L); //,Democratic Republic of the Congo
put("cf",2140L); //,Central African Republic
put("cg",2178L); //,Republic of the Congo
put("ch",2756L); //,Switzerland
put("ci",2384L); //,Cote d'Ivoire
put("ck",2184L); //,Cook Islands
put("cl",2152L); //,Chile
put("cm",2120L); //,Cameroon
put("cn",2156L); //,China
put("co",2170L); //,Colombia
put("cr",2188L); //,Costa Rica
put("cv",2132L); //,Cape Verde
put("cx",2162L); //,Christmas Island
put("cy",2196L); //,Cyprus
put("cz",2203L); //,Czech Republic
put("de",2276L); //,Germany
put("dj",2262L); //,Djibouti
put("dk",2208L); //,Denmark
put("dm",2212L); //,Dominica
put("do",2214L); //,Dominican Republic
put("dz",2012L); //,Algeria
put("ec",2218L); //,Ecuador
put("ee",2233L); //,Estonia
put("eg",2818L); //,Egypt
put("er",2232L); //,Eritrea
put("es",2724L); //,Spain
put("et",2231L); //,Ethiopia
put("fi",2246L); //,Finland
put("fj",2242L); //,Fiji
put("fm",2583L); //,Federated States of Micronesia
put("fr",2250L); //,France
put("ga",2266L); //,Gabon
put("gb",2826L); //,United Kingdom
put("gd",2308L); //,Grenada
put("ge",2268L); //,Georgia
put("gh",2288L); //,Ghana
put("gm",2270L); //,The Gambia
put("gn",2324L); //,Guinea
put("gq",2226L); //,Equatorial Guinea
put("gr",2300L); //,Greece
put("gs",2239L); //,South Georgia and the South Sandwich Islands
put("gt",2320L); //,Guatemala
put("gu",2316L); //,Guam
put("gw",2624L); //,Guinea-Bissau
put("gy",2328L); //,Guyana
put("hm",2334L); //,Heard Island and McDonald Islands
put("hn",2340L); //,Honduras
put("hr",2191L); //,Croatia
put("ht",2332L); //,Haiti
put("hu",2348L); //,Hungary
put("id",2360L); //,Indonesia
put("ie",2372L); //,Ireland
put("il",2376L); //,Israel
put("in",2356L); //,India
put("iq",2368L); //,Iraq
put("is",2352L); //,Iceland
put("it",2380L); //,Italy
put("jm",2388L); //,Jamaica
put("jo",2400L); //,Jordan
put("jp",2392L); //,Japan
put("ke",2404L); //,Kenya
put("kg",2417L); //,Kyrgyzstan
put("kh",2116L); //,Cambodia
put("ki",2296L); //,Kiribati
put("km",2174L); //,Comoros
put("kn",2659L); //,Saint Kitts and Nevis
put("kr",2410L); //,South Korea
put("kw",2414L); //,Kuwait
put("kz",2398L); //,Kazakhstan
put("la",2418L); //,Laos
put("lb",2422L); //,Lebanon
put("lc",2662L); //,Saint Lucia
put("li",2438L); //,Liechtenstein
put("lk",2144L); //,Sri Lanka
put("lr",2430L); //,Liberia
put("ls",2426L); //,Lesotho
put("lt",2440L); //,Lithuania
put("lu",2442L); //,Luxembourg
put("lv",2428L); //,Latvia
put("ly",2434L); //,Libya
put("ma",2504L); //,Morocco
put("mc",2492L); //,Monaco
put("md",2498L); //,Moldova
put("me",2499L); //,Montenegro
put("mg",2450L); //,Madagascar
put("mh",2584L); //,Marshall Islands
put("mk",2807L); //,Macedonia (fyroM)
put("ml",2466L); //,Mali
put("mn",2496L); //,Mongolia
put("mp",2580L); //,Northern Mariana Islands
put("mr",2478L); //,Mauritania
put("mt",2470L); //,Malta
put("mu",2480L); //,Mauritius
put("mv",2462L); //,Maldives
put("mw",2454L); //,Malawi
put("mx",2484L); //,Mexico
put("my",2458L); //,Malaysia
put("mz",2508L); //,Mozambique
put("na",2516L); //,Namibia
put("nc",2540L); //,New Caledonia
put("ne",2562L); //,Niger
put("nf",2574L); //,Norfolk Island
put("ng",2566L); //,Nigeria
put("ni",2558L); //,Nicaragua
put("nl",2528L); //,Netherlands
put("no",2578L); //,Norway
put("np",2524L); //,Nepal
put("nr",2520L); //,Nauru
put("nu",2570L); //,Niue
put("nz",2554L); //,New Zealand
put("om",2512L); //,Oman
put("pa",2591L); //,Panama
put("pe",2604L); //,Peru
put("pf",2258L); //,French Polynesia
put("pg",2598L); //,Papua New Guinea
put("ph",2608L); //,Philippines
put("pk",2586L); //,Pakistan
put("pl",2616L); //,Poland
put("pm",2666L); //,Saint Pierre and Miquelon
put("pn",2612L); //,Pitcairn Islands
put("pt",2620L); //,Portugal
put("pw",2585L); //,Palau
put("py",2600L); //,Paraguay
put("qa",2634L); //,Qatar
put("ro",2642L); //,Romania
put("rs",2688L); //,Serbia
put("ru",2643L); //,Russia
put("rw",2646L); //,Rwanda
put("sa",2682L); //,Saudi Arabia
put("sb",2090L); //,Solomon Islands
put("sc",2690L); //,Seychelles
put("se",2752L); //,Sweden
put("sg",2702L); //,Singapore
put("sh",2654L); //,Saint Helena
put("si",2705L); //,Slovenia
put("sk",2703L); //,Slovakia
put("sl",2694L); //,Sierra Leone
put("sm",2674L); //,San Marino
put("sn",2686L); //,Senegal
put("so",2706L); //,Somalia
put("sr",2740L); //,Suriname
put("st",2678L); //,Sao Tome and Principe
put("sv",2222L); //,El Salvador
put("sz",2748L); //,Swaziland
put("td",2148L); //,Chad
put("tf",2260L); //,French Southern and Antarctic Lands
put("tg",2768L); //,Togo
put("th",2764L); //,Thailand
put("tj",2762L); //,Tajikistan
put("tk",2772L); //,Tokelau
put("tl",2626L); //,Timor-Leste
put("tm",2795L); //,Turkmenistan
put("tn",2788L); //,Tunisia
put("to",2776L); //,Tonga
put("tr",2792L); //,Turkey
put("tt",2780L); //,Trinidad and Tobago
put("tv",2798L); //,Tuvalu
put("tz",2834L); //,Tanzania
put("ua",2804L); //,Ukraine
put("ug",2800L); //,Uganda
put("um",2581L); //,United States Minor Outlying Islands
put("us",2840L); //,United States
put("uy",2858L); //,Uruguay
put("uz",2860L); //,Uzbekistan
put("va",2336L); //,Vatican City
put("vc",2670L); //,Saint Vincent and the Grenadines
put("ve",2862L); //,Venezuela
put("vn",2704L); //,Vietnam
put("vu",2548L); //,Vanuatu
put("wf",2876L); //,Wallis and Futuna
put("ws",2882L); //,Samoa
put("ye",2887L); //,Yemen
put("za",2710L); //,South Africa
put("zm",2894L); //,Zambia
put("zw",2716L); //,Zimbabwe
}
};
Yes - you can use the Targeting Idea Service to specify any location code (which includes countries, regions, cities, etc) for a Search Volume based query.
I am unfamiliar with the Java client library but I am sure it will be similar to the .NET one. The C# code below outputs the search volume for the terms 'blue fedora' and 'red fedora' for queries based in Canada.
var targettingIdeaSvc = (TargetingIdeaService)awUser.GetService(AdWordsService.v201601.TargetingIdeaService);
var searchQueries = new string[] { "blue fedora", "red fedora" };
var ideasPg = targettingIdeaSvc.get(new TargetingIdeaSelector
{
ideaType = IdeaType.KEYWORD,
requestType = RequestType.STATS,
requestedAttributeTypes = new AttributeType[]
{
AttributeType.SEARCH_VOLUME
},
searchParameters = new SearchParameter[]
{
new RelatedToQuerySearchParameter
{
queries = searchQueries,
},
new LocationSearchParameter
{
locations = new Location[]
{
new Location
{
id = 2124 // This is the location id for Canada - comprehensive list of location ids is available here https://developers.google.com/adwords/api/docs/appendix/geotargeting
}
}
},
},
paging = new Paging
{
numberResults = 5,
startIndex = 0
}
});
for (var i = 0; i < searchQueries.Length; i++)
{
var searchVolume = (ideasPg.entries[i].data.First().value as LongAttribute).value;
Console.WriteLine($#"Search Term: ""{searchQueries[i]}"" has search volume of {searchVolume} in Canada");
}
This service uses a location id. You can look up a specific id from the AdWords Geo-Location reference page (or even access this list programatically if you need to)
i am building app where I retrieve list of menus using Json file:
I got poblem within my UITableview , the loading is too slow .
example of Json:
"Mon": [
{
"Type" : "Breakfast",
"Name":"Sweet Potato Breakfast Taquitos",
"Price" : "OMR 1.500",
"Image":"http://img203.imageshack.us/img203/4443/satbf1.jpg",
"Description": "olive oil, sweet potato , onions, jalapenos , cilantro , salt , pepper , shredded cheddar cheese , eggs , milk, corn tortilla , olive oil "
},
{
"Type" : "Lunch",
"Name":"Mexican Rice",
"Price" : "OMR 1.500",
"Image":"http://img21.imageshack.us/img21/4296/mlunch1.jpg",
"Description": "rice, chicken broth, butter, olive oil, onion, garlic, tomato paste, lime juice, cilantro, cumin, salt"
}
]
I found that I have to convert my image path into Base46 string ...(How can I do that automatically )?and how will be the formate of my new path ??
Any help?
1 - If you need to convert only the path into base64 you can use the php function base64_encode()
$img_path = 'http://img203.imageshack.us/img203/4443/satbf1.jpg';
$b64_img_path = base64_encode($img_path);
2 - If you need to convert the image data into base64 all you have to do is:
$img_path = 'http://img203.imageshack.us/img203/4443/satbf1.jpg';
$img_data = file_get_contents($img_path);
$b64_img = base64_encode($img_data);
3 - Use base64_decode() to decode you base64 string.
$b64_str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
$str = base64_decode($b64_str);